Last Comment Bug 697931 - Remove KidHashes when possible
: Remove KidHashes when possible
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
-- normal (vote)
: mozilla10
Assigned To: Nicholas Nethercote [:njn]
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-10-27 21:06 PDT by Nicholas Nethercote [:njn]
Modified: 2011-11-02 23:04 PDT (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (4.12 KB, patch)
2011-10-27 21:06 PDT, Nicholas Nethercote [:njn]
luke: review+
Details | Diff | Splinter Review

Description User image Nicholas Nethercote [:njn] 2011-10-27 21:06:27 PDT
Created attachment 570177 [details] [diff] [review]

Looking at Gmail and TechCrunch I see that 13% of all KidHashes contain 0 or
1 elements.  (If you weight KidHashes by their capacity, it's about 10% of
the space used by KidsHash entries.)  This can happen because
Shape::removeChild() does not convert HASH form KidsPointers back to SHAPE
form when possible.

This patch implements the conversion.  This saves roughly 30--40KB for a
page like Gmail.  It also adds capacity() to Hash{Table,Map,Set}, which
aren't used in the patch but I used them for measurement and they seem like
useful additions in general.
Comment 1 User image Luke Wagner [:luke] 2011-10-27 21:13:01 PDT
Comment on attachment 570177 [details] [diff] [review]

Looks reasonable.  I was initially worried about thrashing back 'n forth but then I remembered that Shape::removeChild is only called from GC.
Comment 2 User image Nicholas Nethercote [:njn] 2011-10-27 23:12:05 PDT
Comment 3 User image Matt Brubeck (:mbrubeck) 2011-10-28 12:21:11 PDT
Comment 4 User image Brendan Eich [:brendan] 2011-11-02 23:04:09 PDT
Thanks, njn -- I should have caught this transition and covered it in the landing last summer.


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