Title: [140012] trunk/Source/WebCore
Revision
140012
Author
vse...@chromium.org
Date
2013-01-17 11:30:07 -0800 (Thu, 17 Jan 2013)

Log Message

Web Inspector: Open resource dialog has poor performance.
https://bugs.webkit.org/show_bug.cgi?id=107122

Reviewed by Pavel Feldman.

Open resource dialog does not make linear number of relayouts on highlight anymore.
Replaced localeCompare with string compare since it is significantly faster.

* inspector/front-end/FilteredItemSelectionDialog.js:
(WebInspector.FilteredItemSelectionDialog.prototype._highlightItems):
(WebInspector.OpenResourceDialog.compareFunction):
(WebInspector.OpenResourceDialog):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140011 => 140012)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 19:27:09 UTC (rev 140011)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 19:30:07 UTC (rev 140012)
@@ -1,3 +1,18 @@
+2013-01-17  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: Open resource dialog has poor performance.
+        https://bugs.webkit.org/show_bug.cgi?id=107122
+
+        Reviewed by Pavel Feldman.
+
+        Open resource dialog does not make linear number of relayouts on highlight anymore.
+        Replaced localeCompare with string compare since it is significantly faster.
+
+        * inspector/front-end/FilteredItemSelectionDialog.js:
+        (WebInspector.FilteredItemSelectionDialog.prototype._highlightItems):
+        (WebInspector.OpenResourceDialog.compareFunction):
+        (WebInspector.OpenResourceDialog):
+
 2013-01-17  Alexis Menard  <ale...@webkit.org>
 
         Add ontransitionend attribute on HTML elements.

Modified: trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js (140011 => 140012)


--- trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js	2013-01-17 19:27:09 UTC (rev 140011)
+++ trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js	2013-01-17 19:30:07 UTC (rev 140012)
@@ -350,11 +350,14 @@
     _highlightItems: function(query)
     {
         var regex = this._createSearchRegExp(query, true);
+        var elementsToHighlight = [];
         for (var i = 0; i < this._delegate.itemsCount(); ++i) {
             var itemElement = this._itemElements[i];
             if (this._itemElementVisible(itemElement) && this._itemElementInViewport(itemElement))
-                this._highlightItem(itemElement, regex);
+                elementsToHighlight.push(itemElement);
         }
+        for (var i = 0; i < elementsToHighlight.length; ++i)
+            this._highlightItem(elementsToHighlight[i], regex);
     },
 
     _clearHighlight: function()
@@ -631,7 +634,11 @@
 
     function compareFunction(uiSourceCode1, uiSourceCode2)
     {
-        return uiSourceCode1.parsedURL.lastPathComponent.localeCompare(uiSourceCode2.parsedURL.lastPathComponent);
+        if (uiSourceCode1.parsedURL.lastPathComponent < uiSourceCode2.parsedURL.lastPathComponent)
+            return -1;
+        if (uiSourceCode1.parsedURL.lastPathComponent > uiSourceCode2.parsedURL.lastPathComponent)
+            return 1;
+        return 0;
     }
     this._uiSourceCodes.sort(compareFunction);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to