Last Comment Bug 699724 - Shrink js::HashTable
: Shrink js::HashTable
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
-- normal (vote)
: mozilla11
Assigned To: Nicholas Nethercote [:njn]
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-11-03 23:07 PDT by Nicholas Nethercote [:njn]
Modified: 2011-11-09 05:34 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (5.69 KB, patch)
2011-11-03 23:07 PDT, Nicholas Nethercote [:njn]
luke: review+
Details | Diff | Splinter Review

Description User image Nicholas Nethercote [:njn] 2011-11-03 23:07:43 PDT
Created attachment 571890 [details] [diff] [review]

HashTable::tableCapacity is redundant with respect to HashTable::hashShift.  The attached patch removes it and replaces occurrences of it with calls to HashTable::capacity(), which computes the capacity from HashTable::hashShift.

This reduces the minimum size of a HashTable object from 24 to 20 bytes on 32-bit platforms, and from 32 to 24 bytes on 64-bit platforms.  Loading Gmail and TechCrunch I see up to 5000 HashTables live at any one time, so it can save up to ~40KB on 64-bit platforms for that workload.  Pretty small, but pretty easy too.  I run Sunspider to check there was no adverse performance effects, changes were neglible.
Comment 1 User image Luke Wagner [:luke] 2011-11-06 17:29:43 PST
Could you also test Kraken and V8?
Comment 2 User image Nicholas Nethercote [:njn] 2011-11-06 17:56:09 PST
Kraken and V8 both also have negligible changes.
Comment 3 User image Luke Wagner [:luke] 2011-11-07 07:34:57 PST
Comment on attachment 571890 [details] [diff] [review]

Comment 4 User image Nicholas Nethercote [:njn] 2011-11-08 21:04:06 PST
Comment 5 User image Marco Bonardo [::mak] 2011-11-09 05:34:16 PST

Note You need to log in before you can comment on or make changes to this bug.