Title: [112540] trunk/Source/WebCore
- Revision
- 112540
- Author
- [email protected]
- Date
- 2012-03-29 09:25:24 -0700 (Thu, 29 Mar 2012)
Log Message
Web Inspector: check more likely condition first in HeapSnapshot._buildAggregates
https://bugs.webkit.org/show_bug.cgi?id=82621
Reviewed by Pavel Feldman.
* inspector/front-end/HeapSnapshot.js: selfSize === 0 is quite rare, moving this condition
to the first place saves 1 of 6 secs on the heap profiler perf test.
(WebInspector.HeapSnapshot.prototype._buildAggregates):
(WebInspector.HeapSnapshot.prototype._buildDominatedNodes): root node is always the first
one and is the only one that doesn't have dominator, so we may start iterating nodes from
the second node and avoid additional check in the loop.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112539 => 112540)
--- trunk/Source/WebCore/ChangeLog 2012-03-29 16:22:13 UTC (rev 112539)
+++ trunk/Source/WebCore/ChangeLog 2012-03-29 16:25:24 UTC (rev 112540)
@@ -1,3 +1,17 @@
+2012-03-29 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: check more likely condition first in HeapSnapshot._buildAggregates
+ https://bugs.webkit.org/show_bug.cgi?id=82621
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/front-end/HeapSnapshot.js: selfSize === 0 is quite rare, moving this condition
+ to the first place saves 1 of 6 secs on the heap profiler perf test.
+ (WebInspector.HeapSnapshot.prototype._buildAggregates):
+ (WebInspector.HeapSnapshot.prototype._buildDominatedNodes): root node is always the first
+ one and is the only one that doesn't have dominator, so we may start iterating nodes from
+ the second node and avoid additional check in the loop.
+
2012-03-29 Pavel Feldman <[email protected]>
Web Inspector: "go to the previous panel" shortcut is painful to maintain
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (112539 => 112540)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-03-29 16:22:13 UTC (rev 112539)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-03-29 16:25:24 UTC (rev 112540)
@@ -1091,7 +1091,7 @@
{
if (filter && !filter(node))
return true;
- if (!node.isNative && node.selfSize === 0)
+ if (!node.selfSize && !node.isNative)
return true;
return false;
}
@@ -1176,29 +1176,29 @@
// All nodes except the root have dominators.
var dominatedNodes = this._dominatedNodes = new Uint32Array(this.nodeCount - 1);
- // Count the number of dominated nodes for each node
- for (var nodeIndex = 0; nodeIndex < this._onlyNodes.length; nodeIndex += this._nodeFieldCount) {
+ // Count the number of dominated nodes for each node. Skip the root (node at
+ // index 0) as it is the only node that dominates itself.
+ for (var nodeIndex = this._nodeFieldCount; nodeIndex < this._onlyNodes.length; nodeIndex += this._nodeFieldCount) {
var dominatorIndex = this._onlyNodes[nodeIndex + this._dominatorOffset];
if (dominatorIndex % this._nodeFieldCount)
throw new Error("Wrong dominatorIndex " + dominatorIndex + " nodeIndex = " + nodeIndex + " nodeCount = " + this.nodeCount);
- // Skip root node. We may simplify this by starting iteration from second node.
- if (nodeIndex === dominatorIndex) continue;
++indexArray[dominatorIndex / this._nodeFieldCount];
}
// Put in the first slot of each dominatedNodes slice the count of entries
// that will be filled.
var firstDominatedNodeIndex = 0;
- for (i = 0; i <= this.nodeCount; ++i) {
+ for (i = 0; i < this.nodeCount; ++i) {
var dominatedCount = dominatedNodes[firstDominatedNodeIndex] = indexArray[i];
indexArray[i] = firstDominatedNodeIndex;
firstDominatedNodeIndex += dominatedCount;
}
- // Fill up the dominatedNodes array with indexes of dominated nodes.
- for (var nodeIndex = 0; nodeIndex < this._onlyNodes.length; nodeIndex += this._nodeFieldCount) {
+ indexArray[this.nodeCount] = dominatedNodes.length;
+ // Fill up the dominatedNodes array with indexes of dominated nodes. Skip the root (node at
+ // index 0) as it is the only node that dominates itself.
+ for (var nodeIndex = this._nodeFieldCount; nodeIndex < this._onlyNodes.length; nodeIndex += this._nodeFieldCount) {
var dominatorIndex = this._onlyNodes[nodeIndex + this._dominatorOffset];
if (dominatorIndex % this._nodeFieldCount)
throw new Error("Wrong dominatorIndex " + dominatorIndex);
- if (nodeIndex === dominatorIndex) continue;
var dominatorPos = dominatorIndex / this._nodeFieldCount;
var dominatedRefIndex = indexArray[dominatorPos];
dominatedRefIndex += (--dominatedNodes[dominatedRefIndex]);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes