Closed Bug 1257207 Opened 8 years ago Closed 8 years ago

Increase ATOM_HASHTABLE_INITIAL_LENGTH

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

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

References

Details

Attachments

(1 file)

The atom table very quickly gets 10,000+ entries in it (or even 100,000+), so
the current value of 2048 for ATOM_HASHTABLE_INITIAL_LENGTH is too low.

Choosing a better value has some subtleties: we add ~2700 static atoms to the
table at start-up, and then we start adding and removing dynamic atoms. If we
make the table too big to start with, when the first dynamic atom gets removed
the load factor will be < 25% and so we will shrink it to 4096 entries.

By choosing an initial length of 4096, we get an initial capacity of 8192.
That's the biggest initial capacity that will let us be > 25% full when the
first dynamic atom is removed (when the count is ~2700), thus avoiding any
shrinking.
Blocks: 1257126
No longer depends on: 1257126
Comment on attachment 8731274 [details] [diff] [review]
Increase ATOM_HASHTABLE_INITIAL_LENGTH

Review of attachment 8731274 [details] [diff] [review]:
-----------------------------------------------------------------

Maybe turn comment 0 into an actual comment as a rationale for the particular size chosen here?
Attachment #8731274 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/c617aafb0e96
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.