Title: [137729] trunk/Source/WebCore
Revision
137729
Author
[email protected]
Date
2012-12-14 00:54:51 -0800 (Fri, 14 Dec 2012)

Log Message

Web Inspector: CPU Profile: Search in "heavy" mode is very slow.
https://bugs.webkit.org/show_bug.cgi?id=103682

Patch by Eugene Klyuchnikov <[email protected]> on 2012-12-14
Reviewed by Pavel Feldman.

In "heavy" mode the searchable tree is much larger than original tree.
That is why search can cause watchdog timer fired.

Simple optimization makes search much faster.

* inspector/front-end/CPUProfileView.js:
(WebInspector.CPUProfileView.prototype.searchCanceled):
Fix cleanup.
(WebInspector.CPUProfileView.prototype.matchesQuery):
Precompute regexp.
(WebInspector.CPUProfileView.prototype.performSearch):
Use precomputed regexp instead of generating one on each iteration.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137728 => 137729)


--- trunk/Source/WebCore/ChangeLog	2012-12-14 08:44:17 UTC (rev 137728)
+++ trunk/Source/WebCore/ChangeLog	2012-12-14 08:54:51 UTC (rev 137729)
@@ -1,3 +1,23 @@
+2012-12-14  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: CPU Profile: Search in "heavy" mode is very slow.
+        https://bugs.webkit.org/show_bug.cgi?id=103682
+
+        Reviewed by Pavel Feldman.
+
+        In "heavy" mode the searchable tree is much larger than original tree.
+        That is why search can cause watchdog timer fired.
+
+        Simple optimization makes search much faster.
+
+        * inspector/front-end/CPUProfileView.js:
+        (WebInspector.CPUProfileView.prototype.searchCanceled):
+        Fix cleanup.
+        (WebInspector.CPUProfileView.prototype.matchesQuery):
+        Precompute regexp.
+        (WebInspector.CPUProfileView.prototype.performSearch):
+        Use precomputed regexp instead of generating one on each iteration.
+
 2012-12-13  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: collect native heap graph and report it to the front-end

Modified: trunk/Source/WebCore/inspector/front-end/CPUProfileView.js (137728 => 137729)


--- trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-12-14 08:44:17 UTC (rev 137728)
+++ trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-12-14 08:54:51 UTC (rev 137729)
@@ -186,6 +186,7 @@
 
                 delete profileNode._searchMatchedSelfColumn;
                 delete profileNode._searchMatchedTotalColumn;
+                delete profileNode._searchMatchedAverageColumn;
                 delete profileNode._searchMatchedCallsColumn;
                 delete profileNode._searchMatchedFunctionColumn;
 
@@ -231,6 +232,8 @@
         if (!isNaN(queryNumber) && !(greaterThan || lessThan))
             equalTo = true;
 
+        var matcher = new RegExp(query.escapeForRegExp(), "i");
+
         function matchesQuery(/*ProfileDataGridNode*/ profileDataGridNode)
         {
             delete profileDataGridNode._searchMatchedSelfColumn;
@@ -298,7 +301,7 @@
                     profileDataGridNode._searchMatchedCallsColumn = true;
             }
 
-            if (profileDataGridNode.functionName.hasSubstring(query, true) || profileDataGridNode.url.hasSubstring(query, true))
+            if (profileDataGridNode.functionName.match(matcher) || profileDataGridNode.url.match(matcher))
                 profileDataGridNode._searchMatchedFunctionColumn = true;
 
             if (profileDataGridNode._searchMatchedSelfColumn ||
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to