Bug 75315 - Reduce memory used by SpaceSplitString.
: Reduce memory used by SpaceSplitString.
Status: RESOLVED FIXED
: WebKit
HTML DOM
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2011-12-28 08:53 PST by
Modified: 2011-12-28 19:55 PST (History)


Attachments
Proposed patch (6.39 KB, patch)
2011-12-28 09:02 PST, Andreas Kling
no flags Review Patch | Details | Formatted Diff | Diff
Proposed patch v2 (6.20 KB, patch)
2011-12-28 15:47 PST, Andreas Kling
no flags Review Patch | Details | Formatted Diff | Diff


Note

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


Description From 2011-12-28 08:53:31 PST
WebCore/dom/SpaceSplitString, used primarily for element class names, is quite wasteful memory wise. We could get massive gains with some simple trickery..
------- Comment #1 From 2011-12-28 09:02:47 PST -------
Created an attachment (id=120679) [details]
Proposed patch
------- Comment #2 From 2011-12-28 09:39:53 PST -------
(From update of attachment 120679 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=120679&action=review

> Source/WebCore/dom/SpaceSplitString.h:75
> +            Vector<AtomicString>* m_vector;

This Vector used to have an inline capacity of 8, which I remember being a speedup at one point.
------- Comment #3 From 2011-12-28 13:10:21 PST -------
I instrumented the Alexa top sites to find out how many substrings we normally find in the class attribute, here are the results (number of substrings: percentage of class attributes):

1: 64.20%
2: 25.64%
3: 6.15%
4: 2.28%
5: 0.95%
6: 0.35%
7: 0.21%
8: 0.13%
9: 0.06%
10: 0.08%
11: 0.03%
12: 0.01%

Given this data, I think we can reduce the inline capacity down to 2 where we'd save good amounts of memory and still cover 90% of cases.
------- Comment #4 From 2011-12-28 15:47:11 PST -------
Created an attachment (id=120705) [details]
Proposed patch v2
------- Comment #5 From 2011-12-28 19:39:38 PST -------
(From update of attachment 120705 [details])
I like it.
------- Comment #6 From 2011-12-28 19:46:34 PST -------
(From update of attachment 120705 [details])
Attachment 120705 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10993749

New failing tests:
http/tests/inspector/resource-tree/resource-tree-document-url.html
------- Comment #7 From 2011-12-28 19:54:53 PST -------
(From update of attachment 120705 [details])
Clearing flags on attachment: 120705

Committed r103790: <http://trac.webkit.org/changeset/103790>
------- Comment #8 From 2011-12-28 19:55:03 PST -------
All reviewed patches have been landed.  Closing bug.