Closed Bug 840809 Opened 12 years ago Closed 12 years ago

Shrink initial size of some per-compartment tables

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

(Whiteboard: [js:t][MemShrink])

Attachments

(3 files)

We have lots of compartments: 150+ at start-up, and hundreds more in a session with lots of tabs. Each compartment has several hash tables. The default capacity of 32 is higher than necessary for some of these. Just by changing the defaults we'll be able to save ~0.5 MB on start-up on a 64-bit build.
The default capacity of a js::HashTable is 32, not 16 as I thought. I wonder if it should be 16, which would match pldhash.
Attachment #713200 - Flags: review?(luke)
In this patch I made four of the tables initialize to the minimum size (which is a capacity of 4). I measured the improvements on Linux64 at start-up (with ~150 compartments present) and after running MemBench50 (~500 compartments present). * debuggees. In normal execution all the tables are empty. Changing to the minimum size table saves about 68 KiB at start-up and 217 KiB on MemBench50. * RegExpCompartment::map_. 70--98% of them fit in the minimum size table. RegExpCompartment::inUse_. 97--98% of them fit in the minimum size table. Together that saves 201 KiB at start-up and 523 KiB on MemBench50. * crossCompartmentWrappers. - At start-up, 80% fit in the current default (cap=32). After shrinking the start size: 39.2% fit in a capacity of 4; another 7% within a capacity of 8, another 17% in a capacity of 16. - In MemBench50, 80% fit in the current default (cap=32). After shrinking, 52% fit in 4, another 11% in 8, and another 16% in 16. This saves 143 KiB at start-up and 236 KiB on MemBench50. Altogether, the savings are 412 KiB at start-up and 976 KiB on MemBench50. Not bad for a trivial patch.
Attachment #713259 - Flags: review?(wmccloskey)
Attachment #713259 - Flags: review?(wmccloskey) → review+
Attachment #713200 - Flags: review?(luke) → review+
Attachment #713229 - Flags: review?(sstangl) → review+
For: http://hg.mozilla.org/mozilla-central/annotate/tip/content/svg/content/src/nsSVGFilters.cpp Why is blame showing virtually every line as having last been touched by rev 121949, attributed to "(part 1) - Fix a comment and rename a constant in HashTable.h"?
> Why is blame showing virtually every line as having last been touched by rev > 121949, attributed to "(part 1) - Fix a comment and rename a constant in > HashTable.h"? That's weird. Each links in comment 4 and comment 5 each name nsSVGFilter.cpp as being modified by the patch, but don't show any diff. And when doing |hg log -p| on the relevant revisions that file doesn't show up. I certainly didn't do anything with that file. Did it change name recently, or something like that? Seems like an hg oddity, and one that's hard to do anything about now :/
The file has always had that name and been at that location. I filed a bug over in Mercurial's bugzilla on this: http://bz.selenic.com/show_bug.cgi?id=3833
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: