Title: [111522] trunk/Source/WebCore
- Revision
- 111522
- Author
- [email protected]
- Date
- 2012-03-21 04:29:01 -0700 (Wed, 21 Mar 2012)
Log Message
Web Inspector: HeapSnapshot: make _bfs twice as fast as the old version.
https://bugs.webkit.org/show_bug.cgi?id=81756
Reviewed by Yury Semikhatsky.
* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshot.prototype._calculateObjectToWindowDistance):
(WebInspector.HeapSnapshot.prototype._bfs):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111521 => 111522)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 11:26:03 UTC (rev 111521)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 11:29:01 UTC (rev 111522)
@@ -1,3 +1,14 @@
+2012-03-21 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: HeapSnapshot: make _bfs twice as fast as the old version.
+ https://bugs.webkit.org/show_bug.cgi?id=81756
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot.prototype._calculateObjectToWindowDistance):
+ (WebInspector.HeapSnapshot.prototype._bfs):
+
2012-03-21 Vineet Chaudhary <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=81705
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (111521 => 111522)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-03-21 11:26:03 UTC (rev 111521)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-03-21 11:29:01 UTC (rev 111522)
@@ -991,16 +991,17 @@
// bfs for Window roots
var list = [];
for (var iter = this.rootNode.edges; iter.hasNext(); iter.next()) {
- if (iter.edge.node.isWindow) {
- list.push(iter.edge.node);
- this._distancesToWindow[iter.edge.node.nodeIndex] = 0;
+ var node = iter.edge.node;
+ if (node.isWindow) {
+ list.push(node.nodeIndex);
+ this._distancesToWindow[node.nodeIndex] = 0;
}
}
this._bfs(list);
// bfs for root
list = [];
- list.push(this.rootNode);
+ list.push(this._rootNodeIndex);
this._distancesToWindow[this.rootNode.nodeIndex] = 0;
this._bfs(list);
},
@@ -1008,20 +1009,21 @@
_bfs: function(list)
{
var index = 0;
+ var node = this.rootNode;
while (index < list.length) {
- var node = list[index++]; // shift generates too much garbage.
+ var nodeIndex = list[index++]; // shift generates too much garbage.
if (index > 100000) {
list = list.slice(index);
index = 0;
}
- var distance = this._distancesToWindow[node.nodeIndex] + 1;
+ var distance = this._distancesToWindow[nodeIndex] + 1;
+ node.nodeIndex = nodeIndex;
for (var iter = node.edges; iter.hasNext(); iter.next()) {
- var edge = iter.edge;
- var childNode = edge.node;
- if (typeof this._distancesToWindow[childNode.nodeIndex] !== "undefined")
+ var childNodeIndex = iter.edge.nodeIndex;
+ if (childNodeIndex in this._distancesToWindow)
continue;
- this._distancesToWindow[childNode.nodeIndex] = distance;
- list.push(childNode);
+ this._distancesToWindow[childNodeIndex] = distance;
+ list.push(childNodeIndex);
}
}
},
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes