Last Comment Bug 699724 - Shrink js::HashTable
: Shrink js::HashTable
Status: RESOLVED FIXED
[MemShrink:P3]
:
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]
Mentors:
Depends on:
Blocks:
  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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


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

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

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 Luke Wagner [:luke] 2011-11-06 17:29:43 PST
Could you also test Kraken and V8?
Comment 2 Nicholas Nethercote [:njn] 2011-11-06 17:56:09 PST
Kraken and V8 both also have negligible changes.
Comment 3 Luke Wagner [:luke] 2011-11-07 07:34:57 PST
Comment on attachment 571890 [details] [diff] [review]
patch

Great!
Comment 4 Nicholas Nethercote [:njn] 2011-11-08 21:04:06 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/c279d3c09e45
Comment 5 Marco Bonardo [::mak] 2011-11-09 05:34:16 PST
https://hg.mozilla.org/mozilla-central/rev/c279d3c09e45

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