Title: [96321] trunk/Source/WebCore
- Revision
- 96321
- Author
- [email protected]
- Date
- 2011-09-29 04:59:27 -0700 (Thu, 29 Sep 2011)
Log Message
Web Inspector: speed-up Network panel. Change _staleResources type from array to object.
https://bugs.webkit.org/show_bug.cgi?id=69081
There is a test with 30 requests.
For the each stage of loading a resource we have an entry in _staleResources array. There are at least 4 stages per request.
NetworkLogView._refresh function is creating/updating the resource row for the each such entry.
This array can be replaced with a hash map just because the resource associated with the entry is the same for all the entries with the same request id.
Reviewed by Pavel Feldman.
Test: inspector/performance/resources/network-append-30-requests.html
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView):
(WebInspector.NetworkLogView.prototype._invalidateAllItems):
(WebInspector.NetworkLogView.prototype.refresh):
(WebInspector.NetworkLogView.prototype._reset):
(WebInspector.NetworkLogView.prototype._refreshResource):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (96320 => 96321)
--- trunk/Source/WebCore/ChangeLog 2011-09-29 11:49:53 UTC (rev 96320)
+++ trunk/Source/WebCore/ChangeLog 2011-09-29 11:59:27 UTC (rev 96321)
@@ -1,3 +1,24 @@
+2011-09-29 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: speed-up Network panel. Change _staleResources type from array to object.
+ https://bugs.webkit.org/show_bug.cgi?id=69081
+
+ There is a test with 30 requests.
+ For the each stage of loading a resource we have an entry in _staleResources array. There are at least 4 stages per request.
+ NetworkLogView._refresh function is creating/updating the resource row for the each such entry.
+ This array can be replaced with a hash map just because the resource associated with the entry is the same for all the entries with the same request id.
+
+ Reviewed by Pavel Feldman.
+
+ Test: inspector/performance/resources/network-append-30-requests.html
+
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkLogView):
+ (WebInspector.NetworkLogView.prototype._invalidateAllItems):
+ (WebInspector.NetworkLogView.prototype.refresh):
+ (WebInspector.NetworkLogView.prototype._reset):
+ (WebInspector.NetworkLogView.prototype._refreshResource):
+
2011-09-28 Pavel Feldman <[email protected]>
Web Inspector: make inspector protocol validation a part of the build process.
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (96320 => 96321)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-09-29 11:49:53 UTC (rev 96320)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-09-29 11:59:27 UTC (rev 96321)
@@ -42,7 +42,7 @@
this._resources = [];
this._resourcesById = {};
this._resourcesByURL = {};
- this._staleResources = [];
+ this._staleResources = {};
this._resourceGridNodes = {};
this._lastResourceGridNodeId = 0;
this._mainResourceLoadTime = -1;
@@ -578,7 +578,10 @@
_invalidateAllItems: function()
{
- this._staleResources = this._resources.slice();
+ for (var i = 0; i < this._resources.length; ++i) {
+ var resource = this._resources[i];
+ this._staleResources[resource.requestId] = resource;
+ }
},
get calculator()
@@ -660,15 +663,14 @@
this._removeAllNodeHighlights();
var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow();
- var staleItemsLength = this._staleResources.length;
var boundariesChanged = false;
if (this.calculator.updateBoundariesForEventTime) {
boundariesChanged = this.calculator.updateBoundariesForEventTime(this._mainResourceLoadTime) || boundariesChanged;
boundariesChanged = this.calculator.updateBoundariesForEventTime(this._mainResourceDOMContentTime) || boundariesChanged;
}
- for (var i = 0; i < staleItemsLength; ++i) {
- var resource = this._staleResources[i];
+ for (var resourceId in this._staleResources) {
+ var resource = this._staleResources[resourceId];
var node = this._resourceGridNode(resource);
if (!node) {
// Create the timeline tree element and graph.
@@ -687,13 +689,12 @@
if (boundariesChanged) {
// The boundaries changed, so all item graphs are stale.
this._invalidateAllItems();
- staleItemsLength = this._staleResources.length;
}
- for (var i = 0; i < staleItemsLength; ++i)
- this._resourceGridNode(this._staleResources[i]).refreshGraph(this.calculator);
+ for (var resourceId in this._staleResources)
+ this._resourceGridNode(this._staleResources[resourceId]).refreshGraph(this.calculator);
- this._staleResources = [];
+ this._staleResources = {};
this._sortItems();
this._updateSummaryBar();
this._dataGrid.updateWidths();
@@ -721,7 +722,7 @@
this._resources = [];
this._resourcesById = {};
this._resourcesByURL = {};
- this._staleResources = [];
+ this._staleResources = {};
this._resourceGridNodes = {};
if (this._dataGrid) {
@@ -782,7 +783,7 @@
_refreshResource: function(resource)
{
- this._staleResources.push(resource);
+ this._staleResources[resource.requestId] = resource;
this._scheduleRefresh();
},
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes