Title: [110853] trunk/Source/WebCore
Revision
110853
Author
yu...@chromium.org
Date
2012-03-15 09:39:47 -0700 (Thu, 15 Mar 2012)

Log Message

Web Inspector: improve HeapSnapshot._buildReversIndex performance
https://bugs.webkit.org/show_bug.cgi?id=81224

Caching node indexes and node count in local variables instead of
calling getters each time reduces the method run time by
factor of 1.5

Reviewed by Pavel Feldman.

* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshot.prototype._buildReverseIndex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110852 => 110853)


--- trunk/Source/WebCore/ChangeLog	2012-03-15 16:35:52 UTC (rev 110852)
+++ trunk/Source/WebCore/ChangeLog	2012-03-15 16:39:47 UTC (rev 110853)
@@ -1,3 +1,17 @@
+2012-03-15  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: improve HeapSnapshot._buildReversIndex performance
+        https://bugs.webkit.org/show_bug.cgi?id=81224
+
+        Caching node indexes and node count in local variables instead of
+        calling getters each time reduces the method run time by
+        factor of 1.5
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshot.prototype._buildReverseIndex):
+
 2012-03-15  Nikolas Zimmermann  <nzimmerm...@rim.com>
 
         SVG Animations update baseVal instead of animVal

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (110852 => 110853)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-03-15 16:35:52 UTC (rev 110852)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-03-15 16:39:47 UTC (rev 110853)
@@ -933,9 +933,11 @@
         //  - "indexArray" is an array of indexes in the "backRefsArray"
         //    with the same positions as in the _nodeIndex.
         var indexArray = this[indexArrayName] = new Int32Array(this._nodeIndex.length);
-        var node = new WebInspector.HeapSnapshotNode(this, this.nodeIndexes[0]);
-        for (var i = 0; i < this.nodeCount; ++i) {
-            node.nodeIndex = this.nodeIndexes[i];
+        var nodeIndexes = this.nodeIndexes;
+        var nodeCount = this.nodeCount;
+        var node = new WebInspector.HeapSnapshotNode(this, nodeIndexes[0]);
+        for (var i = 0; i < nodeCount; ++i) {
+            node.nodeIndex = nodeIndexes[i];
             indexCallback(node, function (position) { ++indexArray[position]; });
         }
         var backRefsCount = 0;
@@ -950,9 +952,8 @@
             indexArray[i] = backRefsPosition;
             backRefsPosition += backRefsCount;
         }
-        node = new WebInspector.HeapSnapshotNode(this, this.nodeIndexes[0]);
-        for (var i = 0; i < this.nodeCount; ++i) {
-            node.nodeIndex = this.nodeIndexes[i];
+        for (var i = 0; i < nodeCount; ++i) {
+            node.nodeIndex = nodeIndexes[i];
             dataCallback(node,
                          function (backRefIndex) { return backRefIndex + (--backRefsArray[backRefIndex]); },
                          function (backRefIndex, destIndex) { backRefsArray[backRefIndex] = destIndex; });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to