Bug 83125

Summary: Web Inspector: linearise aggregate's retaining size calculation
Product: WebKit Reporter: Ilya Tikhonovsky <loislo>
Component: Web Inspector (Deprecated)Assignee: Ilya Tikhonovsky <loislo>
Status: RESOLVED FIXED    
Severity: Normal CC: alph, apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch yurys: review+

Description Ilya Tikhonovsky 2012-04-04 01:52:08 PDT
It gives us no performance gain but gives us the flexibility for future improvements.
Comment 1 Ilya Tikhonovsky 2012-04-04 01:55:21 PDT
Created attachment 135529 [details]
Patch
Comment 2 Ilya Tikhonovsky 2012-04-04 06:39:40 PDT
Created attachment 135579 [details]
Patch
Comment 3 Yury Semikhatsky 2012-04-04 07:05:57 PDT
Comment on attachment 135579 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=135579&action=review

> Source/WebCore/ChangeLog:15
> +2012-04-04  Ilya Tikhonovsky  <loislo@chromium.org>

Remove duplicate entry.

> Source/WebCore/inspector/front-end/HeapSnapshot.js:1136
> +        for (var nodeIndex = this._rootNodeIndex; nodeIndex < onlyNodesLength; nodeIndex += nodeFieldsCount) {

We may want to extract this loop into its own method so that we can measure its performance without _calculateClassesRetainedSize. WDYT?

> Source/WebCore/inspector/front-end/HeapSnapshot.js:1138
> +            var selfSize = onlyNodes[nodeIndex + selfSizeOffset];

Given that in other places here we use "node" to get corresponding field value I'd rather use it here as well for consistency. Does it have any impact on the performance of this method?

> Source/WebCore/inspector/front-end/HeapSnapshot.js:1195
> +            var dominatedIndexFrom = firstDominatedNodeIndex[nodeIndex / nodeFieldCount];

var nodeOrdinal = nodeIndex / nodeFieldCount; ?
Comment 4 Ilya Tikhonovsky 2012-04-04 07:55:21 PDT
Created attachment 135588 [details]
Patch
Comment 5 Ilya Tikhonovsky 2012-04-04 08:25:28 PDT
(In reply to comment #3)
> (From update of attachment 135579 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=135579&action=review
> 
> > Source/WebCore/ChangeLog:15
> > +2012-04-04  Ilya Tikhonovsky  <loislo@chromium.org (:loislo) (c)>
> 
> Remove duplicate entry.

done.

> 
> > Source/WebCore/inspector/front-end/HeapSnapshot.js:1136
> > +        for (var nodeIndex = this._rootNodeIndex; nodeIndex < onlyNodesLength; nodeIndex += nodeFieldsCount) {
> 
> We may want to extract this loop into its own method so that we can measure its performance without _calculateClassesRetainedSize. WDYT?
> 
> > Source/WebCore/inspector/front-end/HeapSnapshot.js:1138
> > +            var selfSize = onlyNodes[nodeIndex + selfSizeOffset];
> 
> Given that in other places here we use "node" to get corresponding field value I'd rather use it here as well for consistency. Does it have any impact on the performance of this method?

v8 doesn't inline our getters. I'd like to inline classIndex too but it a separate patch. Also in general we have no control over filter function.

> 
> > Source/WebCore/inspector/front-end/HeapSnapshot.js:1195
> > +            var dominatedIndexFrom = firstDominatedNodeIndex[nodeIndex / nodeFieldCount];
> 
> var nodeOrdinal = nodeIndex / nodeFieldCount; ?

done
Comment 6 Alexei Filippov 2012-04-04 08:33:10 PDT
lgtm
Comment 7 Ilya Tikhonovsky 2012-04-04 08:50:15 PDT
Committed r113194: <http://trac.webkit.org/changeset/113194>