Web Inspector: inspector slows down pages with many anonymous scripts.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 10:24:16 +0000 (10:24 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 10:24:16 +0000 (10:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107928

Reviewed by Alexander Pavlov.

The problem was that workspace code introduced n^2 complexity for unique URI calculation.

* inspector/front-end/SimpleWorkspaceProvider.js:
(WebInspector.SimpleWorkspaceProvider):
(WebInspector.SimpleWorkspaceProvider.prototype.uniqueURI):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140805 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js

index c7f4044..dadb969 100644 (file)
@@ -1,3 +1,16 @@
+2013-01-25  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: inspector slows down pages with many anonymous scripts.
+        https://bugs.webkit.org/show_bug.cgi?id=107928
+
+        Reviewed by Alexander Pavlov.
+
+        The problem was that workspace code introduced n^2 complexity for unique URI calculation.
+
+        * inspector/front-end/SimpleWorkspaceProvider.js:
+        (WebInspector.SimpleWorkspaceProvider):
+        (WebInspector.SimpleWorkspaceProvider.prototype.uniqueURI):
+
 2013-01-25  Jussi Kukkonen  <jussi.kukkonen@intel.com>
 
         [CMake][EFL] Build ThirdParty/leveldb when IndexedDB is enabled
index 87d4e41..96bb5e9 100644 (file)
@@ -38,6 +38,7 @@ WebInspector.SimpleWorkspaceProvider = function(workspace)
     this._workspace = workspace;
     /** @type {Object.<string, WebInspector.ContentProvider>} */
     this._contentProviders = {};
+    this._lastUniqueSuffix = 0;
 }
 
 /**
@@ -129,8 +130,8 @@ WebInspector.SimpleWorkspaceProvider.prototype = {
     uniqueURI: function(uri)
     {
         var uniqueURI = uri;
-        for (var i = 1; this._contentProviders[uniqueURI]; ++i)
-            uniqueURI = uri + " (" + i + ")";
+        while (this._contentProviders[uniqueURI])
+            uniqueURI = uri + " (" + (++this._lastUniqueSuffix) + ")";
         return uniqueURI;
     },