Bug 86281 - 44% of Vector buffer capacity is unused
Summary: 44% of Vector buffer capacity is unused
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords:
Depends on: 86438 86568 86434 86435 86436 86437 86560 86561 86562 86563
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-11 20:36 PDT by Simon Fraser (smfr)
Modified: 2013-05-08 07:07 PDT (History)
15 users (show)

See Also:


Attachments
Patch to log vector stats (13.08 KB, patch)
2012-05-11 20:45 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Delta on the previous patch to dump stacks when sparse vectors are destroyed. (1.77 KB, patch)
2012-05-11 20:55 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (31.04 KB, patch)
2012-05-14 21:45 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (fixes shrinkToFit) (31.27 KB, patch)
2012-05-15 08:45 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2012-05-11 20:36:18 PDT
I added logging to VectorBuffer to track the high water marks of m_size, and m_buffer.m_capacity. I then loaded a few common sites, and dumped the data:

Data on m_size frequency:

Size    Freq    %       Cumul   %
0       749339  54.26%  749339  54.26%
1       233851  16.93%  983190  71.19%
2       110291  7.99%   1093481 79.18%
3       56286   4.08%   1149767 83.26%
4       37070   2.68%   1186837 85.94%
5       25134   1.82%   1211971 87.76%
6       31826   2.30%   1243797 90.06%
7       10837   0.78%   1254634 90.85%
8       17178   1.24%   1271812 92.09%
9       6798    0.49%   1278610 92.59%
10      7826    0.57%   1286436 93.15%
11      5996    0.43%   1292432 93.59%
12      3844    0.28%   1296276 93.87%
13      5522    0.40%   1301798 94.26%
14      4251    0.31%   1306049 94.57%
15      3038    0.22%   1309087 94.79%
16      2785    0.20%   1311872 94.99%
17      2424    0.18%   1314296 95.17%
18      2571    0.19%   1316867 95.36%
19      1903    0.14%   1318770 95.49%
20      1274    0.09%   1320044 95.59%
21      1712    0.12%   1321756 95.71%
22      1906    0.14%   1323662 95.85%
23      2158    0.16%   1325820 96.00%
24      1265    0.09%   1327085 96.10%
25      763     0.06%   1327848 96.15%
26      1328    0.10%   1329176 96.25%
27      948     0.07%   1330124 96.32%
28      710     0.05%   1330834 96.37%
29      2449    0.18%   1333283 96.54%
30      636     0.05%   1333919 96.59%
31      582     0.04%   1334501 96.63%
32      1059    0.08%   1335560 96.71%
33      998     0.07%   1336558 96.78%
34      512     0.04%   1337070 96.82%
35      511     0.04%   1337581 96.86%
36      614     0.04%   1338195 96.90%
37      424     0.03%   1338619 96.93%
38      532     0.04%   1339151 96.97%
39      410     0.03%   1339561 97.00%
40      733     0.05%   1340294 97.05%
41      422     0.03%   1340716 97.08%
42      281     0.02%   1340997 97.10%
43      326     0.02%   1341323 97.13%
44      460     0.03%   1341783 97.16%
45      361     0.03%   1342144 97.19%
46      719     0.05%   1342863 97.24%
47      858     0.06%   1343721 97.30%
48      384     0.03%   1344105 97.33%
49+   36895   2.67%   1381000 100.00%

Total for all vectors allocated every: 67822.00KB used of 165432.40KB (41.00% used)

Data on fullness (at high water mark size):

% full      Freq        %
0           1048058     75.89%
1           2600        0.19%
2           4002        0.29%
3           3019        0.22%
4           10976       0.79%
5           5637        0.41%
6           3864        0.28%
7           89799       6.50%
8           5431        0.39%
9           2030        0.15%
10          4333        0.31%
11          2677        0.19%
12          693         0.05%
13          26030       1.88%
14          585         0.04%
15          1364        0.10%
16          1108        0.08%
17          911         0.07%
18          1378        0.10%
19          14983       1.08%
20          1737        0.13%
21          665         0.05%
22          838         0.06%
23          1071        0.08%
24          103         0.01%
25          26880       1.95%
26          41          0.00%
27          60          0.00%
28          15          0.00%
29          530         0.04%
30          1034        0.07%
31          31          0.00%
32          4636        0.34%
33          32          0.00%
34          26          0.00%
35          404         0.03%
36          415         0.03%
37          44          0.00%
38          8025        0.58%
39          13          0.00%
40          206         0.01%
41          401         0.03%
42          40          0.00%
43          33          0.00%
44          3260        0.24%
45          27          0.00%
46          20          0.00%
47          101         0.01%
48          32          0.00%
49          19          0.00%
50          11619       0.84%
51          38          0.00%
52          36          0.00%
53          17          0.00%
54          134         0.01%
55          44          0.00%
56          17          0.00%
57          1832        0.13%
58          61          0.00%
59          43          0.00%
60          56          0.00%
61          55          0.00%
62          25          0.00%
63          2719        0.20%
64          14          0.00%
65          56          0.00%
66          93          0.01%
67          24          0.00%
68          25          0.00%
69          1381        0.10%
70          45          0.00%
71          38          0.00%
72          46          0.00%
73          17          0.00%
74          0           0.00%
75          4439        0.32%
76          4           0.00%
77          16          0.00%
78          25          0.00%
79          33          0.00%
80          9           0.00%
81          1659        0.12%
82          1761        0.13%
83          589         0.04%
84          580         0.04%
85          587         0.04%
86          1607        0.12%
87          507         0.04%
88          1358        0.10%
89          1044        0.08%
90          385         0.03%
91          1006        0.07%
92          557         0.04%
93          736         0.05%
94          1794        0.13%
95          519         0.04%
96          735         0.05%
97          671         0.05%
98          519         0.04%
99          528         0.04%
100         60680       4.39%
Comment 1 Simon Fraser (smfr) 2012-05-11 20:42:57 PDT
Data ignoring "unused" vectors (those with capacity 0):

vector size frequencies:

Size        Frequency   %           Cumul       %
0           60661       12.44%      60661       12.44%
1           174952      35.88%      235613      48.32%
2           63735       13.07%      299348      61.39%
3           35794       7.34%       335142      68.73%
4           19660       4.03%       354802      72.76%
5           11048       2.27%       365850      75.03%
6           10082       2.07%       375932      77.09%
7           7556        1.55%       383488      78.64%
8           9797        2.01%       393285      80.65%
9           4380        0.90%       397665      81.55%
10          5784        1.19%       403449      82.74%
11          4295        0.88%       407744      83.62%
12          2707        0.56%       410451      84.17%
13          4217        0.86%       414668      85.04%
14          3094        0.63%       417762      85.67%
15          1782        0.37%       419544      86.04%
16          1841        0.38%       421385      86.41%
17          1621        0.33%       423006      86.75%
18          1706        0.35%       424712      87.10%
19          1497        0.31%       426209      87.40%
20          950         0.19%       427159      87.60%
21          1279        0.26%       428438      87.86%
22          1647        0.34%       430085      88.20%
23          1767        0.36%       431852      88.56%
24          1095        0.22%       432947      88.78%
25          521         0.11%       433468      88.89%
26          1084        0.22%       434552      89.11%
27          705         0.14%       435257      89.26%
28          403         0.08%       435660      89.34%
29          2456        0.50%       438116      89.84%
30          491         0.10%       438607      89.95%
31          344         0.07%       438951      90.02%
32          395         0.08%       439346      90.10%
33          851         0.17%       440197      90.27%
34          552         0.11%       440749      90.38%
35          275         0.06%       441024      90.44%
36          496         0.10%       441520      90.54%
37          338         0.07%       441858      90.61%
38          564         0.12%       442422      90.73%
39          389         0.08%       442811      90.81%
40          679         0.14%       443490      90.95%
41          412         0.08%       443902      91.03%
42          207         0.04%       444109      91.07%
43          309         0.06%       444418      91.14%
44          470         0.10%       444888      91.23%
45          366         0.08%       445254      91.31%
46          674         0.14%       445928      91.45%
47          820         0.17%       446748      91.62%
48          341         0.07%       447089      91.68%
49          40547       8.32%       487636      100.00%


% fullness frequencies:

% full      Freq        %
0           60661       12.44%
1           2988        0.61%
2           3780        0.78%
3           3270        0.67%
4           12711       2.61%
5           5150        1.06%
6           4010        0.82%
7           146310      30.00%
8           4983        1.02%
9           2249        0.46%
10          4570        0.94%
11          2631        0.54%
12          755         0.15%
13          33811       6.93%
14          616         0.13%
15          1292        0.26%
16          1289        0.26%
17          905         0.19%
18          1313        0.27%
19          18414       3.78%
20          2172        0.45%
21          643         0.13%
22          1131        0.23%
23          1125        0.23%
24          98          0.02%
25          32034       6.57%
26          82          0.02%
27          70          0.01%
28          12          0.00%
29          618         0.13%
30          1322        0.27%
31          34          0.01%
32          5827        1.19%
33          38          0.01%
34          30          0.01%
35          497         0.10%
36          450         0.09%
37          76          0.02%
38          10849       2.22%
39          19          0.00%
40          252         0.05%
41          463         0.09%
42          40          0.01%
43          34          0.01%
44          3978        0.82%
45          27          0.01%
46          32          0.01%
47          105         0.02%
48          58          0.01%
49          29          0.01%
50          12405       2.54%
51          22          0.00%
52          38          0.01%
53          19          0.00%
54          182         0.04%
55          45          0.01%
56          20          0.00%
57          2279        0.47%
58          60          0.01%
59          43          0.01%
60          71          0.01%
61          59          0.01%
62          25          0.01%
63          2924        0.60%
64          15          0.00%
65          54          0.01%
66          153         0.03%
67          32          0.01%
68          44          0.01%
69          1659        0.34%
70          36          0.01%
71          21          0.00%
72          68          0.01%
73          16          0.00%
74          3           0.00%
75          4460        0.91%
76          13          0.00%
77          17          0.00%
78          30          0.01%
79          35          0.01%
80          44          0.01%
81          1775        0.36%
82          2356        0.48%
83          679         0.14%
84          723         0.15%
85          699         0.14%
86          2041        0.42%
87          665         0.14%
88          1650        0.34%
89          1486        0.30%
90          514         0.11%
91          1287        0.26%
92          721         0.15%
93          1164        0.24%
94          2101        0.43%
95          839         0.17%
96          955         0.20%
97          827         0.17%
98          671         0.14%
99          980         0.20%
100         66758       13.69%
Comment 2 Simon Fraser (smfr) 2012-05-11 20:45:11 PDT
Created attachment 141549 [details]
Patch to log vector stats
Comment 3 Andreas Kling 2012-05-11 20:51:20 PDT
Antti and I have been discussing an alternate allocation scheme for some high-volume classes that contain vectors, specifically StylePropertySet and ElementAttributeData.

The idea is basically to make the objects "variable size" and replace the Vector<CSSProperty> and Vector<Attribute> (respectively) by a size and an array. If/when the array mutates (presumably a rare occurrence) we replace the buffer by a heap-allocated Vector and redirect to that.
Comment 4 Simon Fraser (smfr) 2012-05-11 20:55:25 PDT
Created attachment 141550 [details]
Delta on the previous patch to dump stacks when sparse vectors are destroyed.
Comment 5 Simon Fraser (smfr) 2012-05-11 20:57:30 PDT
Andreas: isn't that what inline capacity does, basically?
Comment 6 Simon Fraser (smfr) 2012-05-11 21:06:06 PDT
The data above don't distinguish between inline and heap-allocated buffer.
Comment 7 Simon Fraser (smfr) 2012-05-11 21:15:52 PDT
My logging needs to track live Vectors, not just collect data on destruction. The data are skewed by lots of stack-allocated Vectors with inline capacity.
Comment 8 Andreas Kling 2012-05-11 21:46:04 PDT
(In reply to comment #5)
> Andreas: isn't that what inline capacity does, basically?

Kind of. Vector is currently { capacity, size, buffer }, and the new approach would allow us to eliminate 'capacity' from these structures and pack 'buffer' tightly with no overhead when there's no mutation.

Also, another thing that we should probably do is turn Vector's capacity and size into 32-bit unsigned integers. I don't think there's a good reason for them to be size_t, and this would save us 8 bytes per Vector on 64-bit.
Comment 9 Geoffrey Garen 2012-05-12 14:45:56 PDT
An alternative approach to optimize for 0 is to create an automatic wrapper around an OwnPtr<Vector<T>>.
Comment 10 Simon Fraser (smfr) 2012-05-12 22:40:46 PDT
I added some code to track extant Vectors, and log the unused space in those from time to time.

In a single tab after browsing to a few sites, I have:
145340 extant vectors wasting 23.21MB 67.59% (used 11671558 bytes, capacity 36014131 bytes):

RPRVT was about 228M at this point, so this accounts for about 10% of our memory use:

PID    COMMAND      %CPU TIME     #TH   #WQ  #POR #MREG RPRVT  RSHRD  RSIZE  VPRVT  VSIZE  PGRP  PPID  STATE    UID  FAULTS    COW     MSGSENT   MSGRECV   SYSBSD    SYSMACH   CSW
28172  WebProcess   0.0  00:27.57 10    1    128  685   228M   91M    520M   745M   4215M  28157 28171 sleeping 501  207107    1784    30340     13840     69599+    37470     8734+

I'm collecting stack traces for Vector allocation, so I can find the most wasteful allocation points.
Comment 11 Simon Fraser (smfr) 2012-05-14 21:21:46 PDT
Logging from a CFRunLoopObserver (so only logging non-temporaries), I get:


42191 extant vectors wasting 8.64MB 75.17% (used 2992158 bytes, capacity 12051495 bytes):

Most wasteful 5 stacks
3579 vectors, 164.22KB used of 2237.70KB, 2073.48KB wasted at:
1   0x107e4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x107e3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x107e2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x107e2fd63 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x107e30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)
6   0x107e1e47b WebCore::RuleSet::addRulesFromSheet(WebCore::StyleSheetInternal*, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*, WebCore::ContainerNode const*)
7   0x107e1ec05 WebCore::StyleResolver::appendAuthorStylesheets(unsigned int, WTF::Vector<WTF::RefPtr<WebCore::StyleSheet>, 0ul> const&)
8   0x107e1d449 WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
9   0x107e1ca5c WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
10  0x106b3dd0c WebCore::Document::createStyleResolver()
11  0x1068cde2b WebCore::Document::styleResolver()
12  0x106d4363a WebCore::Element::styleForRenderer()
13  0x106d438af WebCore::Element::recalcStyle(WebCore::Node::StyleChange)
14  0x106b3be32 WebCore::Document::recalcStyle(WebCore::Node::StyleChange)
15  0x106b3c963 WebCore::Document::updateStyleIfNeeded()
16  0x106e61751 WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
17  0x104e2e55b WebKit::WebPage::layoutIfNeeded()
18  0x104c51d85 WebKit::DrawingAreaImpl::display(WebKit::UpdateInfo&)
19  0x104c50ef8 WebKit::DrawingAreaImpl::display()
20  0x104c4f8b5 WebKit::DrawingAreaImpl::displayTimerFired()
21  0x104c540cb WebCore::RunLoop::Timer<WebKit::DrawingAreaImpl>::fired()
22  0x107c92f3d WebCore::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*)
23  0x7fff99ad3934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
24  0x7fff99ad3486 __CFRunLoopDoTimer
25  0x7fff99ab3e11 __CFRunLoopRun
26  0x7fff99ab3486 CFRunLoopRunSpecific
27  0x7fff966804d3 RunCurrentEventLoopInMode
28  0x7fff96687781 ReceiveNextEventCommon
29  0x7fff9668760e BlockUntilNextEventMatchingListInMode
30  0x7fff94a79e31 _DPSNextEvent
31  0x7fff94a79735 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]

2696 vectors, 164.22KB used of 2237.70KB, 2073.48KB wasted at:
1   0x107e4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x107e3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x107e2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x107e2fd06 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x107e30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)
6   0x107e1e47b WebCore::RuleSet::addRulesFromSheet(WebCore::StyleSheetInternal*, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*, WebCore::ContainerNode const*)
7   0x107e1ec05 WebCore::StyleResolver::appendAuthorStylesheets(unsigned int, WTF::Vector<WTF::RefPtr<WebCore::StyleSheet>, 0ul> const&)
8   0x107e1d449 WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
9   0x107e1ca5c WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
10  0x106b3dd0c WebCore::Document::createStyleResolver()
11  0x1068cde2b WebCore::Document::styleResolver()
12  0x106d4363a WebCore::Element::styleForRenderer()
13  0x106d438af WebCore::Element::recalcStyle(WebCore::Node::StyleChange)
14  0x106b3be32 WebCore::Document::recalcStyle(WebCore::Node::StyleChange)
15  0x106b3c963 WebCore::Document::updateStyleIfNeeded()
16  0x106e61751 WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
17  0x104e2e55b WebKit::WebPage::layoutIfNeeded()
18  0x104c51d85 WebKit::DrawingAreaImpl::display(WebKit::UpdateInfo&)
19  0x104c50ef8 WebKit::DrawingAreaImpl::display()
20  0x104c4f8b5 WebKit::DrawingAreaImpl::displayTimerFired()
21  0x104c540cb WebCore::RunLoop::Timer<WebKit::DrawingAreaImpl>::fired()
22  0x107c92f3d WebCore::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*)
23  0x7fff99ad3934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
24  0x7fff99ad3486 __CFRunLoopDoTimer
25  0x7fff99ab3e11 __CFRunLoopRun
26  0x7fff99ab3486 CFRunLoopRunSpecific
27  0x7fff966804d3 RunCurrentEventLoopInMode
28  0x7fff96687781 ReceiveNextEventCommon
29  0x7fff9668760e BlockUntilNextEventMatchingListInMode
30  0x7fff94a79e31 _DPSNextEvent
31  0x7fff94a79735 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]

2572 vectors, 164.22KB used of 2237.70KB, 2073.48KB wasted at:
1   0x107e4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x107e3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x107e2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x107e2fd63 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x107e30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)
6   0x107e1e47b WebCore::RuleSet::addRulesFromSheet(WebCore::StyleSheetInternal*, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*, WebCore::ContainerNode const*)
7   0x107e1ec05 WebCore::StyleResolver::appendAuthorStylesheets(unsigned int, WTF::Vector<WTF::RefPtr<WebCore::StyleSheet>, 0ul> const&)
8   0x107e1d449 WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
9   0x107e1ca5c WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
10  0x106b3dd0c WebCore::Document::createStyleResolver()
11  0x1068cde2b WebCore::Document::styleResolver()
12  0x106d4363a WebCore::Element::styleForRenderer()
13  0x106d438af WebCore::Element::recalcStyle(WebCore::Node::StyleChange)
14  0x106b3be32 WebCore::Document::recalcStyle(WebCore::Node::StyleChange)
15  0x106b3c963 WebCore::Document::updateStyleIfNeeded()
16  0x106b3cb33 WebCore::Document::updateLayout()
17  0x106b3ccd5 WebCore::Document::updateLayoutIgnorePendingStylesheets()
18  0x1069bde50 WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const
19  0x1069bdda7 WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(WebCore::CSSPropertyID) const
20  0x1069d6092 WebCore::CSSComputedStyleDeclaration::getPropertyCSSValueInternal(WebCore::CSSPropertyID)
21  0x1072995d2 _ZN7WebCoreL17cssPropertyGetterEPN3JSC9ExecStateEPNS_21JSCSSStyleDeclarationEj
22  0x107299356 _ZN7WebCoreL25cssPropertyGetterCallbackEPN3JSC9ExecStateENS0_7JSValueEj
23  0x105b2500a JSC::PropertySlot::getValue(JSC::ExecState*, JSC::Identifier const&) const
24  0x105b359ad JSC::JSValue::get(JSC::ExecState*, JSC::Identifier const&, JSC::PropertySlot&) const
25  0x105b358c5 JSC::JSValue::get(JSC::ExecState*, JSC::Identifier const&) const
26  0x105ecfe26 JSC::LLInt::getByVal(JSC::ExecState*, JSC::JSValue, JSC::JSValue)
27  0x105ecaab0 llint_slow_path_get_by_val
28  0x105ed2dce llint_op_get_by_val
29  0x105cc4ba9 JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*)
30  0x105cc0b2e JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
31  0x105b8931b JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)

2398 vectors, 164.22KB used of 2237.70KB, 2073.48KB wasted at:
1   0x107e4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x107e3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x107e2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x107e2fd06 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x107e30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)
6   0x107e1e47b WebCore::RuleSet::addRulesFromSheet(WebCore::StyleSheetInternal*, WebCore::MediaQueryEvaluator const&, WebCore::StyleResolver*, WebCore::ContainerNode const*)
7   0x107e1ec05 WebCore::StyleResolver::appendAuthorStylesheets(unsigned int, WTF::Vector<WTF::RefPtr<WebCore::StyleSheet>, 0ul> const&)
8   0x107e1d449 WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
9   0x107e1ca5c WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
10  0x106b3dd0c WebCore::Document::createStyleResolver()
11  0x1068cde2b WebCore::Document::styleResolver()
12  0x106d4363a WebCore::Element::styleForRenderer()
13  0x106d438af WebCore::Element::recalcStyle(WebCore::Node::StyleChange)
14  0x106b3be32 WebCore::Document::recalcStyle(WebCore::Node::StyleChange)
15  0x106b3c963 WebCore::Document::updateStyleIfNeeded()
16  0x106b3cb33 WebCore::Document::updateLayout()
17  0x106b3ccd5 WebCore::Document::updateLayoutIgnorePendingStylesheets()
18  0x1069bde50 WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const
19  0x1069bdda7 WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(WebCore::CSSPropertyID) const
20  0x1069d6092 WebCore::CSSComputedStyleDeclaration::getPropertyCSSValueInternal(WebCore::CSSPropertyID)
21  0x1072995d2 _ZN7WebCoreL17cssPropertyGetterEPN3JSC9ExecStateEPNS_21JSCSSStyleDeclarationEj
22  0x107299356 _ZN7WebCoreL25cssPropertyGetterCallbackEPN3JSC9ExecStateENS0_7JSValueEj
23  0x105b2500a JSC::PropertySlot::getValue(JSC::ExecState*, JSC::Identifier const&) const
24  0x105b359ad JSC::JSValue::get(JSC::ExecState*, JSC::Identifier const&, JSC::PropertySlot&) const
25  0x105b358c5 JSC::JSValue::get(JSC::ExecState*, JSC::Identifier const&) const
26  0x105ecfe26 JSC::LLInt::getByVal(JSC::ExecState*, JSC::JSValue, JSC::JSValue)
27  0x105ecaab0 llint_slow_path_get_by_val
28  0x105ed2dce llint_op_get_by_val
29  0x105cc4ba9 JSC::JITCode::execute(JSC::RegisterFile*, JSC::ExecState*, JSC::JSGlobalData*)
30  0x105cc0b2e JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
31  0x105b8931b JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)

126 vectors, 164.22KB used of 2237.70KB, 2073.48KB wasted at:
1   0x107e4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x107e3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x107e2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x107e2fdbb WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x107e1f331 _ZN7WebCoreL11makeRuleSetERKN3WTF6VectorINS_13StyleResolver11RuleFeatureELm0EEE
6   0x107e1ee48 WebCore::StyleResolver::collectFeatures()
7   0x107e1ec5f WebCore::StyleResolver::appendAuthorStylesheets(unsigned int, WTF::Vector<WTF::RefPtr<WebCore::StyleSheet>, 0ul> const&)
8   0x107e1d449 WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
9   0x107e1ca5c WebCore::StyleResolver::StyleResolver(WebCore::Document*, bool)
10  0x106b3dd0c WebCore::Document::createStyleResolver()
11  0x1068cde2b WebCore::Document::styleResolver()
12  0x106d4363a WebCore::Element::styleForRenderer()
13  0x1078c32de WebCore::NodeRendererFactory::createRendererIfNeeded()
14  0x10789eec9 WebCore::Node::createRendererIfNeeded()
15  0x106d42e78 WebCore::Element::attach()
16  0x106f2ba1c _ZN7WebCoreL11executeTaskERNS_24HTMLConstructionSiteTaskE
17  0x106f2b89d WebCore::HTMLConstructionSite::executeQueuedTasks()
18  0x106f2bfa6 WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(WebCore::AtomicHTMLToken&)
19  0x107023062 WebCore::HTMLTreeBuilder::defaultForBeforeHTML()
20  0x10701d1c2 WebCore::HTMLTreeBuilder::processEndOfFile(WebCore::AtomicHTMLToken&)
21  0x107018a18 WebCore::HTMLTreeBuilder::processToken(WebCore::AtomicHTMLToken&)
22  0x107017adb WebCore::HTMLTreeBuilder::constructTreeFromAtomicToken(WebCore::AtomicHTMLToken&)
23  0x1070179ec WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&)
24  0x106f4e1db WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
25  0x106f4dc0d WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode)
26  0x106f4da95 WebCore::HTMLDocumentParser::prepareToStopParsing()
27  0x106f4ee63 WebCore::HTMLDocumentParser::attemptToEnd()
28  0x106f4eeb8 WebCore::HTMLDocumentParser::finish()
29  0x106bac097 WebCore::DocumentWriter::end()
30  0x106e272cd WebCore::FrameLoader::init()
31  0x104ddf0fc WebCore::Frame::init()
Comment 12 Simon Fraser (smfr) 2012-05-14 21:33:22 PDT
If we use fewer stack frames to amalgamate stacks, we see that JSC has some waste as well:

105272 extant vectors wasting 19.34MB 75.93% (used 6428218 bytes, capacity 26705401 bytes):

Most wasteful 20 stacks
13177 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10344e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x10343c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x10342fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x10342fd63 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x103430400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)

10050 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10344e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x10343c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x10342fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x10342fd06 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x103430400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)

1379 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011acae5 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
2   0x10119c795 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
3   0x101195868 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10129e9f2 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x101297a88 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

6818 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10116fa15 WTF::Vector<JSC::Identifier, 0ul>::Vector()
2   0x1013b9eb0 JSC::FunctionParameters::FunctionParameters(JSC::ParameterNode*)
3   0x1013b9e7d JSC::FunctionParameters::FunctionParameters(JSC::ParameterNode*)
4   0x1013bac29 JSC::FunctionParameters::create(JSC::ParameterNode*)
5   0x1013b9f54 JSC::FunctionBodyNode::finishParsing(JSC::SourceCode const&, JSC::ParameterNode*, JSC::Identifier const&)

1457 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x101179f25 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
2   0x1011795f5 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
3   0x101179594 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x101179435 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x1011792e9 JSC::CodeBlock::RareData::RareData()

1457 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x101179e15 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
2   0x101179615 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
3   0x1011795a6 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x101179435 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x1011792e9 JSC::CodeBlock::RareData::RareData()

1446 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011ac6f5 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x1011abef5 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x1011abe86 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x10119c7d5 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x1011958a1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

1446 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011ac6f5 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x1011abef5 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x1011abe86 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x10119c7d5 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x10119588e JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

1446 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011ad185 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector()
2   0x1011ad105 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector()
3   0x1011ad0b6 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
4   0x10119c645 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
5   0x101195771 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

1446 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011ac9d5 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector()
2   0x1011ac955 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector()
3   0x1011ac906 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
4   0x10119c7b5 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
5   0x10119587b JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

1446 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10117ea85 WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>::Vector()
2   0x10117ea05 WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>::Vector()
3   0x1011ad0a4 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
4   0x10119c645 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
5   0x101195771 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

3385 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x101405075 WTF::Vector<WTF::RefPtr<WTF::StringImpl>, 0ul>::Vector()
2   0x101404ff5 WTF::Vector<WTF::RefPtr<WTF::StringImpl>, 0ul>::Vector()
3   0x101404fc6 JSC::SourceProviderCacheItem::SourceProviderCacheItem(int, int)
4   0x101403be1 JSC::SourceProviderCacheItem::SourceProviderCacheItem(int, int)
5   0x10140ce93 bool JSC::Parser<JSC::Lexer<unsigned short> >::parseFunctionInfo<(JSC::FunctionRequirements)0, false, JSC::SyntaxChecker>(JSC::SyntaxChecker&, JSC::Identifier const*&, JSC::SyntaxChecker::FormalParameterList&, JSC::SyntaxChecker::FunctionBody&, int&, int&, int&)

1379 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011acf15 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
2   0x10119c685 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
3   0x101195797 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10129e9f2 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x101297a88 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

310 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10344e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x10343c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x10342fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x10342ff1c WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x103430400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)

1457 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10117a155 WTF::Vector<JSC::LineInfo, 0ul>::Vector()
2   0x1011793f5 WTF::Vector<JSC::LineInfo, 0ul>::Vector()
3   0x1011792c9 JSC::CodeBlock::RareData::RareData()
4   0x101175ba5 JSC::CodeBlock::RareData::RareData()
5   0x1011741e4 JSC::CodeBlock::createRareDataIfNecessary()

1457 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x10117a255 WTF::Vector<JSC::ExpressionRangeInfo, 0ul>::Vector()
2   0x1011793d5 WTF::Vector<JSC::ExpressionRangeInfo, 0ul>::Vector()
3   0x1011792b9 JSC::CodeBlock::RareData::RareData()
4   0x101175ba5 JSC::CodeBlock::RareData::RareData()
5   0x1011741e4 JSC::CodeBlock::createRareDataIfNecessary()

1446 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x101185ee5 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
2   0x101185d05 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
3   0x1011ac8f4 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
4   0x10119c7b5 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
5   0x10119587b JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

1379 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011ace35 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
2   0x10119c6d5 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
3   0x1011957bd JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10129e9f2 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x101297a88 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

5512 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x103413da5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
2   0x10340e195 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
3   0x1034086ac WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
4   0x103408659 WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
5   0x102071775 WebCore::StylePropertySet::create(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)

1379 vectors, 618.36KB used of 8247.54KB, 7629.18KB wasted at:
1   0x1011a69e5 WTF::Vector<JSC::WriteBarrier<JSC::Unknown>, 0ul>::Vector()
2   0x10119dbd5 WTF::Vector<JSC::WriteBarrier<JSC::Unknown>, 0ul>::Vector()
3   0x1011958f7 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10129e9f2 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x101297a88 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
Comment 13 Darin Adler 2012-05-14 21:36:34 PDT
In most cases we can get rid of this by reserving capacity appropriately for the common cases.
Comment 14 Darin Adler 2012-05-14 21:37:20 PDT
Why do these all say: 618.36KB used of 8247.54KB, 7629.18KB wasted

I think maybe the math is wrong?
Comment 15 Simon Fraser (smfr) 2012-05-14 21:42:26 PDT
Sorry those numbers are wrong, yes.
Comment 16 Simon Fraser (smfr) 2012-05-14 21:45:02 PDT
Created attachment 141851 [details]
Patch
Comment 17 Simon Fraser (smfr) 2012-05-14 21:49:36 PDT
Fixed numbers:


131116 extant vectors wasting 16.07MB 63.23% (used 9795761 bytes, capacity 26641203 bytes):

Most wasteful 20 stacks
7150 vectors, 389.80KB used of 4488.95KB, 4099.14KB wasted at:
1   0x108c4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x108c3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x108c2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x108c2fd63 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x108c30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)

5324 vectors, 227.66KB used of 3330.98KB, 3103.32KB wasted at:
1   0x108c4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x108c3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x108c2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x108c2fd06 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x108c30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)

1996 vectors, 134.75KB used of 998.00KB, 863.25KB wasted at:
1   0x1069acb15 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
2   0x10699c7c5 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
3   0x106995898 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2232 vectors, 0.31KB used of 558.00KB, 557.69KB wasted at:
1   0x106979f55 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
2   0x106979625 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
3   0x1069795c4 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x106979465 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x106979319 JSC::CodeBlock::RareData::RareData()

2232 vectors, 17.44KB used of 558.00KB, 540.56KB wasted at:
1   0x106979e45 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
2   0x106979645 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
3   0x1069795d6 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x106979465 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x106979319 JSC::CodeBlock::RareData::RareData()

2200 vectors, 17.20KB used of 550.00KB, 532.80KB wasted at:
1   0x1069ac725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x1069abf25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x1069abeb6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x10699c805 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x1069958d1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2200 vectors, 20.92KB used of 550.00KB, 529.08KB wasted at:
1   0x1069ad1b5 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector()
2   0x1069ad135 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector()
3   0x1069ad0e6 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
4   0x10699c675 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
5   0x1069957a1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2200 vectors, 21.14KB used of 550.00KB, 528.86KB wasted at:
1   0x1069ac725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x1069abf25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x1069abeb6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x10699c805 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x1069958be JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2200 vectors, 43.21KB used of 550.47KB, 507.26KB wasted at:
1   0x1069aca05 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector()
2   0x1069ac985 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector()
3   0x1069ac936 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
4   0x10699c7e5 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
5   0x1069958ab JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

6369 vectors, 60.39KB used of 546.38KB, 485.98KB wasted at:
1   0x10696fa45 WTF::Vector<JSC::Identifier, 0ul>::Vector()
2   0x106bb9ee0 JSC::FunctionParameters::FunctionParameters(JSC::ParameterNode*)
3   0x106bb9ead JSC::FunctionParameters::FunctionParameters(JSC::ParameterNode*)
4   0x106bbac59 JSC::FunctionParameters::create(JSC::ParameterNode*)
5   0x106bb9f84 JSC::FunctionBodyNode::finishParsing(JSC::SourceCode const&, JSC::ParameterNode*, JSC::Identifier const&)

2200 vectors, 240.43KB used of 687.50KB, 447.07KB wasted at:
1   0x10697eab5 WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>::Vector()
2   0x10697ea35 WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>::Vector()
3   0x1069ad0d4 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
4   0x10699c675 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
5   0x1069957a1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

4567 vectors, 98.24KB used of 496.27KB, 398.02KB wasted at:
1   0x106c050a5 WTF::Vector<WTF::RefPtr<WTF::StringImpl>, 0ul>::Vector()
2   0x106c05025 WTF::Vector<WTF::RefPtr<WTF::StringImpl>, 0ul>::Vector()
3   0x106c04ff6 JSC::SourceProviderCacheItem::SourceProviderCacheItem(int, int)
4   0x106c03c11 JSC::SourceProviderCacheItem::SourceProviderCacheItem(int, int)
5   0x106c0cec3 bool JSC::Parser<JSC::Lexer<unsigned short> >::parseFunctionInfo<(JSC::FunctionRequirements)0, false, JSC::SyntaxChecker>(JSC::SyntaxChecker&, JSC::Identifier const*&, JSC::SyntaxChecker::FormalParameterList&, JSC::SyntaxChecker::FunctionBody&, int&, int&, int&)

1996 vectors, 323.72KB used of 665.81KB, 342.09KB wasted at:
1   0x1069acf45 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
2   0x10699c6b5 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
3   0x1069957c7 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

1996 vectors, 102.31KB used of 372.38KB, 270.06KB wasted at:
1   0x1069ace65 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
2   0x10699c705 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
3   0x1069957ed JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2232 vectors, 66.41KB used of 310.97KB, 244.56KB wasted at:
1   0x10697a185 WTF::Vector<JSC::LineInfo, 0ul>::Vector()
2   0x106979425 WTF::Vector<JSC::LineInfo, 0ul>::Vector()
3   0x1069792f9 JSC::CodeBlock::RareData::RareData()
4   0x106975bd5 JSC::CodeBlock::RareData::RareData()
5   0x106974214 JSC::CodeBlock::createRareDataIfNecessary()

1996 vectors, 57.59KB used of 276.23KB, 218.64KB wasted at:
1   0x1069acd65 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector()
2   0x10699c725 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector()
3   0x106995800 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2232 vectors, 486.60KB used of 692.79KB, 206.19KB wasted at:
1   0x10697a285 WTF::Vector<JSC::ExpressionRangeInfo, 0ul>::Vector()
2   0x106979405 WTF::Vector<JSC::ExpressionRangeInfo, 0ul>::Vector()
3   0x1069792e9 JSC::CodeBlock::RareData::RareData()
4   0x106975bd5 JSC::CodeBlock::RareData::RareData()
5   0x106974214 JSC::CodeBlock::createRareDataIfNecessary()

9271 vectors, 698.42KB used of 901.81KB, 203.39KB wasted at:
1   0x108c13da5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
2   0x108c0e195 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
3   0x108c086ac WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
4   0x108c08659 WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
5   0x107871775 WebCore::StylePropertySet::create(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)

2200 vectors, 380.47KB used of 550.00KB, 169.53KB wasted at:
1   0x106985f15 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
2   0x106985d35 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
3   0x1069ac924 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
4   0x10699c7e5 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
5   0x1069958ab JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

314 vectors, 99.38KB used of 266.05KB, 166.68KB wasted at:
1   0x108c4e855 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x108c3c115 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x108c2fba1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x108c2ff1c WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x108c30400 WebCore::RuleSet::addStyleRule(WebCore::StyleRule*, bool, bool, bool)
Comment 18 Simon Fraser (smfr) 2012-05-15 08:16:47 PDT
My data collection ignored the effects of shrinkToFit, so the above results are suspect. I'll collect some new data.
Comment 19 Simon Fraser (smfr) 2012-05-15 08:39:41 PDT
After fixing shrinkToFit the wastage is not as bad as I thought.



22148 extant vectors wasting 0.64MB 20.19% (used 2653873 bytes, capacity 3325039 bytes):

Most wasteful 20 stacks
10078 vectors, 747.23KB used of 974.86KB, 227.62KB wasted at:
1   0x10dcb86e5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
2   0x10dcb2ad5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
3   0x10dcacfec WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
4   0x10dcacf99 WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
5   0x10c914a75 WebCore::StylePropertySet::create(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)

332 vectors, 5.55KB used of 41.50KB, 35.95KB wasted at:
1   0x10c960e75 WTF::Vector<WTF::RefPtr<WebCore::CSSValue>, 0ul>::Vector()
2   0x10c960115 WTF::Vector<WTF::RefPtr<WebCore::CSSValue>, 0ul>::Vector()
3   0x10c95f5c1 WebCore::CSSValueList::CSSValueList(WebCore::CSSValue::ValueListSeparator)
4   0x10c95f56b WebCore::CSSValueList::CSSValueList(WebCore::CSSValue::ValueListSeparator)
5   0x10c87a2bc WebCore::CSSValueList::createCommaSeparated()

32 vectors, 25.50KB used of 47.62KB, 22.12KB wasted at:
1   0x10ba4f745 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
2   0x10ba3eaf5 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
3   0x10ba37c07 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10bb41462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x10bb3a4f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

148 vectors, 1.73KB used of 23.62KB, 21.89KB wasted at:
1   0x10c74559a WTF::Vector<WebCore::FrameData, 0ul>::Vector(unsigned long)
2   0x10c74450d WTF::Vector<WebCore::FrameData, 0ul>::Vector(unsigned long)
3   0x10c742619 WebCore::BitmapImage::BitmapImage(WebCore::ImageObserver*)
4   0x10c74254d WebCore::BitmapImage::BitmapImage(WebCore::ImageObserver*)
5   0x10c770059 WebCore::BitmapImage::create(WebCore::ImageObserver*)

15 vectors, 1.31KB used of 21.00KB, 19.69KB wasted at:
1   0x10bb021b5 WTF::Vector<JSC::DFG::OSREntryData, 0ul>::Vector()
2   0x10bb01c45 WTF::Vector<JSC::DFG::OSREntryData, 0ul>::Vector()
3   0x10bb01bc9 JSC::CodeBlock::DFGData::DFGData()
4   0x10bb01b65 JSC::CodeBlock::DFGData::DFGData()
5   0x10bb00d76 JSC::CodeBlock::createDFGDataIfNecessary()

32 vectors, 5.25KB used of 23.00KB, 17.75KB wasted at:
1   0x10ba4f665 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
2   0x10ba3eb45 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
3   0x10ba37c2d JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10bb41462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x10bb3a4f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

32 vectors, 3.94KB used of 20.12KB, 16.19KB wasted at:
1   0x10ba4f565 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector()
2   0x10ba3eb65 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector()
3   0x10ba37c40 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10bb41462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x10bb3a4f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

27 vectors, 1.64KB used of 16.88KB, 15.23KB wasted at:
1   0x10dcf3255 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x10dce0a55 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x10dcd44e1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x10dcd46fb WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x10dcc3c71 _ZN7WebCoreL11makeRuleSetERKN3WTF6VectorINS_13StyleResolver11RuleFeatureELm0EEE

15 vectors, 5.25KB used of 20.06KB, 14.81KB wasted at:
1   0x10ba4f745 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
2   0x10ba3eaf5 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
3   0x10ba37490 JSC::CodeBlock::CodeBlock(JSC::CodeBlock::CopyParsedBlockTag, JSC::CodeBlock&, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*)
4   0x10bb41892 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::CodeBlock::CopyParsedBlockTag, JSC::FunctionCodeBlock&)
5   0x10bb3a0b3 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::CodeBlock::CopyParsedBlockTag, JSC::FunctionCodeBlock&)

32 vectors, 2.19KB used of 16.00KB, 13.81KB wasted at:
1   0x10ba4f315 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
2   0x10ba3ec05 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
3   0x10ba37cd8 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x10bb41462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x10bb3a4f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

295 vectors, 7.12KB used of 20.03KB, 12.91KB wasted at:
1   0x10dcb86e5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
2   0x10dcb2ad5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
3   0x10dcace74 WebCore::StylePropertySet::StylePropertySet(WebCore::CSSParserMode)
4   0x10dcace2b WebCore::StylePropertySet::StylePropertySet(WebCore::CSSParserMode)
5   0x10c6e3627 WebCore::StylePropertySet::create(WebCore::CSSParserMode)

47 vectors, 0.38KB used of 11.75KB, 11.37KB wasted at:
1   0x10ba1c1c5 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
2   0x10ba1b9c5 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
3   0x10ba1b956 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x10ba1b7e5 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x10ba1b699 JSC::CodeBlock::RareData::RareData()

47 vectors, 0.62KB used of 11.75KB, 11.12KB wasted at:
1   0x10ba1c2d5 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
2   0x10ba1b9a5 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
3   0x10ba1b944 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x10ba1b7e5 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x10ba1b699 JSC::CodeBlock::RareData::RareData()

15 vectors, 1.75KB used of 11.00KB, 9.25KB wasted at:
1   0x10ba4f665 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
2   0x10ba3eb45 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
3   0x10ba374c2 JSC::CodeBlock::CodeBlock(JSC::CodeBlock::CopyParsedBlockTag, JSC::CodeBlock&, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*)
4   0x10bb41892 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::CodeBlock::CopyParsedBlockTag, JSC::FunctionCodeBlock&)
5   0x10bb3a0b3 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::CodeBlock::CopyParsedBlockTag, JSC::FunctionCodeBlock&)

3 vectors, 24.22KB used of 32.94KB, 8.72KB wasted at:
1   0x10ca364b5 WTF::Vector<WebCore::ResourceResponse, 0ul>::Vector()
2   0x10ca2fed5 WTF::Vector<WebCore::ResourceResponse, 0ul>::Vector()
3   0x10ca2bd5f WebCore::DocumentLoader::DocumentLoader(WebCore::ResourceRequest const&, WebCore::SubstituteData const&)
4   0x10ca2bbc5 WebCore::DocumentLoader::DocumentLoader(WebCore::ResourceRequest const&, WebCore::SubstituteData const&)
5   0x10ac8ba71 WebCore::DocumentLoader::create(WebCore::ResourceRequest const&, WebCore::SubstituteData const&)

160 vectors, 1152.43KB used of 1160.83KB, 8.40KB wasted at:
1   0x10c6b0f85 WTF::Vector<char, 0ul>::Vector()
2   0x10c6ad965 WTF::Vector<char, 0ul>::Vector()
3   0x10dbe376d WebCore::SharedBuffer::SharedBuffer(char const*, int)
4   0x10dbe3723 WebCore::SharedBuffer::SharedBuffer(char const*, int)
5   0x10ccdc93f WebCore::SharedBuffer::create(char const*, int)

71 vectors, 0.55KB used of 8.88KB, 8.32KB wasted at:
1   0x10c960e75 WTF::Vector<WTF::RefPtr<WebCore::CSSValue>, 0ul>::Vector()
2   0x10c960115 WTF::Vector<WTF::RefPtr<WebCore::CSSValue>, 0ul>::Vector()
3   0x10c95f5c1 WebCore::CSSValueList::CSSValueList(WebCore::CSSValue::ValueListSeparator)
4   0x10c95f56b WebCore::CSSValueList::CSSValueList(WebCore::CSSValue::ValueListSeparator)
5   0x10c85970c WebCore::CSSValueList::createSpaceSeparated()

14 vectors, 0.62KB used of 8.75KB, 8.12KB wasted at:
1   0x10dcf3255 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x10dce0a55 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x10dcd44e1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x10dcd46a3 WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x10dcc3c71 _ZN7WebCoreL11makeRuleSetERKN3WTF6VectorINS_13StyleResolver11RuleFeatureELm0EEE

449 vectors, 6.78KB used of 14.59KB, 7.81KB wasted at:
1   0x10dc0b025 WTF::Vector<WTF::AtomicString, 4ul>::Vector()
2   0x10dc0abe5 WTF::Vector<WTF::AtomicString, 4ul>::Vector()
3   0x10dc0a652 WebCore::SpaceSplitStringData::SpaceSplitStringData(WTF::AtomicString const&)
4   0x10dc0a56d WebCore::SpaceSplitStringData::SpaceSplitStringData(WTF::AtomicString const&)
5   0x10dc0a3ff WebCore::SpaceSplitStringData::create(WTF::AtomicString const&)

32 vectors, 0.25KB used of 8.00KB, 7.75KB wasted at:
1   0x10ba4ef25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x10ba4e725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x10ba4e6b6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x10ba3ec45 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x10ba37d11 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
Comment 20 Simon Fraser (smfr) 2012-05-15 08:43:09 PDT
Previous data was with JS disabled (but some noise from JS, presumably from Reader). Here's data with JS enabled:



143217 extant vectors wasting 8.19MB 43.88% (used 10984622 bytes, capacity 19571855 bytes):

Most wasteful 20 stacks
2400 vectors, 198.53KB used of 1200.00KB, 1001.47KB wasted at:
1   0x106976315 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
2   0x106965c05 WTF::Vector<JSC::ValueProfile, 0ul>::Vector()
3   0x10695ecd8 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a68462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a614f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2501 vectors, 0.12KB used of 625.25KB, 625.12KB wasted at:
1   0x1069432d5 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
2   0x1069429a5 WTF::Vector<JSC::InlineCallFrame, 4ul>::Vector()
3   0x106942944 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x1069427e5 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x106942699 JSC::CodeBlock::RareData::RareData()

2501 vectors, 19.54KB used of 625.25KB, 605.71KB wasted at:
1   0x1069431c5 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
2   0x1069429c5 WTF::Vector<WTF::Vector<JSC::InlineCallFrame, 4ul>*, 32ul>::Vector()
3   0x106942956 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
4   0x1069427e5 WTF::SegmentedVector<JSC::InlineCallFrame, 4ul>::SegmentedVector()
5   0x106942699 JSC::CodeBlock::RareData::RareData()

2467 vectors, 19.28KB used of 616.75KB, 597.47KB wasted at:
1   0x106975f25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x106975725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x1069756b6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x106965c45 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x10695ed11 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2467 vectors, 22.40KB used of 616.75KB, 594.35KB wasted at:
1   0x106975f25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
2   0x106975725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector()
3   0x1069756b6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x106965c45 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x10695ecfe JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2467 vectors, 24.67KB used of 616.75KB, 592.08KB wasted at:
1   0x1069769b5 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector()
2   0x106976935 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector()
3   0x1069768e6 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
4   0x106965ab5 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
5   0x10695ebe1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2467 vectors, 50.30KB used of 618.45KB, 568.14KB wasted at:
1   0x106976205 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector()
2   0x106976185 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector()
3   0x106976136 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
4   0x106965c25 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
5   0x10695eceb JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

7256 vectors, 77.48KB used of 637.12KB, 559.65KB wasted at:
1   0x106938dc5 WTF::Vector<JSC::Identifier, 0ul>::Vector()
2   0x106b83aa0 JSC::FunctionParameters::FunctionParameters(JSC::ParameterNode*)
3   0x106b83a6d JSC::FunctionParameters::FunctionParameters(JSC::ParameterNode*)
4   0x106b84819 JSC::FunctionParameters::create(JSC::ParameterNode*)
5   0x106b83b44 JSC::FunctionBodyNode::finishParsing(JSC::SourceCode const&, JSC::ParameterNode*, JSC::Identifier const&)

2467 vectors, 286.45KB used of 770.94KB, 484.49KB wasted at:
1   0x106947ef5 WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>::Vector()
2   0x106947e75 WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>::Vector()
3   0x1069768d4 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
4   0x106965ab5 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector()
5   0x10695ebe1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2400 vectors, 280.12KB used of 718.12KB, 438.00KB wasted at:
1   0x106976745 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
2   0x106965af5 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector()
3   0x10695ec07 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a68462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a614f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2400 vectors, 123.88KB used of 444.00KB, 320.12KB wasted at:
1   0x106976665 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
2   0x106965b45 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector()
3   0x10695ec2d JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a68462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a614f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

12122 vectors, 916.64KB used of 1192.89KB, 276.25KB wasted at:
1   0x108bdf6e5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
2   0x108bd9ad5 WTF::Vector<WebCore::CSSProperty, 4ul>::Vector()
3   0x108bd3fec WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
4   0x108bd3f99 WebCore::StylePropertySet::StylePropertySet(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)
5   0x10783ba75 WebCore::StylePropertySet::create(WebCore::CSSProperty const*, int, WebCore::CSSParserMode)

2400 vectors, 63.88KB used of 295.42KB, 231.55KB wasted at:
1   0x106976565 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector()
2   0x106965b65 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector()
3   0x10695ec40 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a68462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a614f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2467 vectors, 425.50KB used of 616.75KB, 191.25KB wasted at:
1   0x10694f355 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
2   0x10694f175 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
3   0x106976124 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
4   0x106965c25 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector()
5   0x10695eceb JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2467 vectors, 0.66KB used of 154.19KB, 153.52KB wasted at:
1   0x106976035 WTF::Vector<JSC::RareCaseProfile, 8ul>::Vector()
2   0x106975705 WTF::Vector<JSC::RareCaseProfile, 8ul>::Vector()
3   0x1069756a4 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x106965c45 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x10695ed11 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

2467 vectors, 15.26KB used of 154.19KB, 138.93KB wasted at:
1   0x106976035 WTF::Vector<JSC::RareCaseProfile, 8ul>::Vector()
2   0x106975705 WTF::Vector<JSC::RareCaseProfile, 8ul>::Vector()
3   0x1069756a4 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
4   0x106965c45 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector()
5   0x10695ecfe JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

3972 vectors, 860.75KB used of 993.00KB, 132.25KB wasted at:
1   0x10694f355 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
2   0x10694f175 WTF::Vector<JSC::ValueProfile, 8ul>::Vector()
3   0x10694ed8f void WTF::SegmentedVector<JSC::ValueProfile, 8ul>::append<JSC::ValueProfile>(JSC::ValueProfile const&)
4   0x10691b060 JSC::CodeBlock::addValueProfile(int)
5   0x10690d687 JSC::BytecodeGenerator::emitProfiledOpcode(JSC::OpcodeID)

2400 vectors, 111.07KB used of 199.08KB, 88.00KB wasted at:
1   0x106978e05 WTF::Vector<unsigned int, 0ul>::Vector()
2   0x106965a95 WTF::Vector<unsigned int, 0ul>::Vector()
3   0x10695ebbb JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a68462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a614f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)

117 vectors, 7.11KB used of 73.12KB, 66.02KB wasted at:
1   0x108c1a255 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
2   0x108c07a55 WTF::Vector<WebCore::RuleData, 0ul>::Vector()
3   0x108bfb4e1 WebCore::RuleSet::addToRuleSet(WTF::AtomicStringImpl*, WTF::HashMap<WTF::AtomicStringImpl*, WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> >, WTF::PtrHash<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::AtomicStringImpl*>, WTF::HashTraits<WTF::OwnPtr<WTF::Vector<WebCore::RuleData, 0ul> > > >&, WebCore::RuleData const&)
4   0x108bfb6fb WebCore::RuleSet::addRule(WebCore::StyleRule*, WebCore::CSSSelector*, bool, bool, bool)
5   0x108beac71 _ZN7WebCoreL11makeRuleSetERKN3WTF6VectorINS_13StyleResolver11RuleFeatureELm0EEE

2400 vectors, 46.38KB used of 110.20KB, 63.82KB wasted at:
1   0x106978e05 WTF::Vector<unsigned int, 0ul>::Vector()
2   0x106965a95 WTF::Vector<unsigned int, 0ul>::Vector()
3   0x10695ed2e JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
4   0x106a68462 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
5   0x106a614f8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
Comment 21 Simon Fraser (smfr) 2012-05-15 08:45:41 PDT
Created attachment 141981 [details]
Patch (fixes shrinkToFit)
Comment 22 Yong Li 2012-08-21 14:02:22 PDT
Vector::shrinkToFit always allocates a new buffer and copies the elements over. Is there any reason we are not using realloc?

What I can think is: if realloc anyway allocates a new address, the memcpy it does is unnecessary because anyway the copy ctor will be called by Vector.

However when shrinking memory, realloc usually keeps the same address (not guaranteed though). Also we can check VectorTraits and in the case memcpy is what we want, we don't have to do it again.

Thoughts?
Comment 23 Darin Adler 2012-08-21 14:25:28 PDT
(In reply to comment #22)
> Vector::shrinkToFit always allocates a new buffer and copies the elements over. Is there any reason we are not using realloc?

One reason is that if the element class for the Vector has a non-trivial copy constructor, then realloc will not copy the elements correctly.
Comment 24 Yong Li 2012-08-21 14:56:16 PDT
(In reply to comment #23)
> (In reply to comment #22)
> > Vector::shrinkToFit always allocates a new buffer and copies the elements over. Is there any reason we are not using realloc?
> 
> One reason is that if the element class for the Vector has a non-trivial copy constructor, then realloc will not copy the elements correctly.

But we can call the copy ctor again. Yeah it wastes cpu time on the extra memcpy. But if we can assume (on some ports) that, in most cases, a shrink doesn't relocate the memory, then it can still be perf boost
Comment 25 Darin Adler 2012-08-21 15:29:38 PDT
(In reply to comment #24)
> (In reply to comment #23)
> > (In reply to comment #22)
> > > Vector::shrinkToFit always allocates a new buffer and copies the elements over. Is there any reason we are not using realloc?
> > 
> > One reason is that if the element class for the Vector has a non-trivial copy constructor, then realloc will not copy the elements correctly.
> 
> But we can call the copy ctor again.

That doesn’t solve the problem. Since realloc both allocates the new memory and deallocates the old, it’s too late to call the copy constructor. We still have the old binary data in the new location, but that’s not good enough. There’s no guarantee that the copy constructor can work if the argument passed is the same as the this pointer, nor generally a guarantee that it’s OK to call any function, copy constructor included, on an object that was binary copied.

We may be able to make a better shrinkToFit with realloc for all the important cases; but this technical obstacle does get in the way of the general case.
Comment 26 Yong Li 2012-08-22 07:32:51 PDT
(In reply to comment #25)
> (In reply to comment #24)
> > (In reply to comment #23)
> > > (In reply to comment #22)
> > > > Vector::shrinkToFit always allocates a new buffer and copies the elements over. Is there any reason we are not using realloc?
> > > 
> > > One reason is that if the element class for the Vector has a non-trivial copy constructor, then realloc will not copy the elements correctly.
> > 
> > But we can call the copy ctor again.
> 
> That doesn’t solve the problem. Since realloc both allocates the new memory and deallocates the old, it’s too late to call the copy constructor. We still have the old binary data in the new location, but that’s not good enough. 

Ha... I forgot this.

> 
> We may be able to make a better shrinkToFit with realloc for all the important cases; but this technical obstacle does get in the way of the general case.

We can use realloc only when canCopyWithMemcpy is true, or use a new trait. Also, how about using OSAllocator/mmap for large vectors?
Comment 27 Eric Seidel (no email) 2012-11-20 02:11:12 PST
This data is very interesting.  Thank you for collecting it, Simon.  It appears this effort has paused for the while?
Comment 28 Simon Fraser (smfr) 2012-11-23 11:34:28 PST
This was a one-off investigation. I don't have time to continue it.