Bug 86732

Summary: Web Inspector: speed-up markQueriableHeapObjects function.
Product: WebKit Reporter: Ilya Tikhonovsky <loislo>
Component: Web Inspector (Deprecated)Assignee: Ilya Tikhonovsky <loislo>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 87089    
Attachments:
Description Flags
Patch yurys: review+

Description Ilya Tikhonovsky 2012-05-17 07:47:38 PDT
inline getters

RESULT heap-snapshot: _markQueriableHeapObjects= 879 ms
vs
RESULT heap-snapshot: _markQueriableHeapObjects= 42 ms
Comment 1 Ilya Tikhonovsky 2012-05-17 07:49:16 PDT
Created attachment 142474 [details]
Patch
Comment 2 Yury Semikhatsky 2012-05-17 07:57:29 PDT
Comment on attachment 142474 [details]
Patch

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

> Source/WebCore/inspector/front-end/HeapSnapshot.js:-1180
> -                list.push(iter.edge.node.nodeIndex);

Please revert this part.

> Source/WebCore/inspector/front-end/HeapSnapshot.js:1197
> +                         ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]

Please realign these two lines.

> Source/WebCore/inspector/front-end/HeapSnapshot.js:1213
> +        this._flags = new Uint32Array(this.nodeCount);

Does it make any difference?
Comment 3 Ilya Tikhonovsky 2012-05-17 22:43:57 PDT
Committed r117545: <http://trac.webkit.org/changeset/117545>
Comment 4 Ilya Tikhonovsky 2012-05-17 22:58:40 PDT
(In reply to comment #2)
> (From update of attachment 142474 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=142474&action=review
> 
> > Source/WebCore/inspector/front-end/HeapSnapshot.js:-1180
> > -                list.push(iter.edge.node.nodeIndex);
> 
> Please revert this part.

done

> 
> > Source/WebCore/inspector/front-end/HeapSnapshot.js:1197
> > +                         ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]
> 
> Please realign these two lines.

done

> 
> > Source/WebCore/inspector/front-end/HeapSnapshot.js:1213
> > +        this._flags = new Uint32Array(this.nodeCount);
> 
> Does it make any difference?

This line is the root for the sake of which all the patch has been made.
Before the patch the array was sparse. Actually it was a hash map.
Now we have no memory overhead and we can make it external.
It gives us an additional speed boost and reduces js heap footprint.