Changeset 96321 in webkit


Ignore:
Timestamp:
Sep 29, 2011 4:59:27 AM (13 years ago)
Author:
loislo@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96320 r96321  
     12011-09-29  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: speed-up Network panel. Change _staleResources type from array to object.
     4        https://bugs.webkit.org/show_bug.cgi?id=69081
     5
     6        There is a test with 30 requests.
     7        For the each stage of loading a resource we have an entry in _staleResources array. There are at least 4 stages per request.
     8        NetworkLogView._refresh function is creating/updating the resource row for the each such entry.
     9        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.
     10
     11        Reviewed by Pavel Feldman.
     12
     13        Test: inspector/performance/resources/network-append-30-requests.html
     14
     15        * inspector/front-end/NetworkPanel.js:
     16        (WebInspector.NetworkLogView):
     17        (WebInspector.NetworkLogView.prototype._invalidateAllItems):
     18        (WebInspector.NetworkLogView.prototype.refresh):
     19        (WebInspector.NetworkLogView.prototype._reset):
     20        (WebInspector.NetworkLogView.prototype._refreshResource):
     21
    1222011-09-28  Pavel Feldman  <pfeldman@google.com>
    223
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r96318 r96321  
    4343    this._resourcesById = {};
    4444    this._resourcesByURL = {};
    45     this._staleResources = [];
     45    this._staleResources = {};
    4646    this._resourceGridNodes = {};
    4747    this._lastResourceGridNodeId = 0;
     
    579579    _invalidateAllItems: function()
    580580    {
    581         this._staleResources = this._resources.slice();
     581        for (var i = 0; i < this._resources.length; ++i) {
     582            var resource = this._resources[i];
     583            this._staleResources[resource.requestId] = resource;
     584        }
    582585    },
    583586
     
    661664        this._removeAllNodeHighlights();
    662665        var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow();
    663         var staleItemsLength = this._staleResources.length;
    664666        var boundariesChanged = false;
    665667        if (this.calculator.updateBoundariesForEventTime) {
     
    668670        }
    669671
    670         for (var i = 0; i < staleItemsLength; ++i) {
    671             var resource = this._staleResources[i];
     672        for (var resourceId in this._staleResources) {
     673            var resource = this._staleResources[resourceId];
    672674            var node = this._resourceGridNode(resource);
    673675            if (!node) {
     
    688690            // The boundaries changed, so all item graphs are stale.
    689691            this._invalidateAllItems();
    690             staleItemsLength = this._staleResources.length;
    691         }
    692 
    693         for (var i = 0; i < staleItemsLength; ++i)
    694             this._resourceGridNode(this._staleResources[i]).refreshGraph(this.calculator);
    695 
    696         this._staleResources = [];
     692        }
     693
     694        for (var resourceId in this._staleResources)
     695            this._resourceGridNode(this._staleResources[resourceId]).refreshGraph(this.calculator);
     696
     697        this._staleResources = {};
    697698        this._sortItems();
    698699        this._updateSummaryBar();
     
    722723        this._resourcesById = {};
    723724        this._resourcesByURL = {};
    724         this._staleResources = [];
     725        this._staleResources = {};
    725726        this._resourceGridNodes = {};
    726727
     
    783784    _refreshResource: function(resource)
    784785    {
    785         this._staleResources.push(resource);
     786        this._staleResources[resource.requestId] = resource;
    786787        this._scheduleRefresh();
    787788    },
Note: See TracChangeset for help on using the changeset viewer.