Title: [200740] trunk/Source/WebInspectorUI
Revision
200740
Author
commit-qu...@webkit.org
Date
2016-05-11 21:32:54 -0700 (Wed, 11 May 2016)

Log Message

Web Inspector: 4% of time in TimelineOverviewGraph adding/removing classList styles on TimelineRecordBar
https://bugs.webkit.org/show_bug.cgi?id=157607

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-05-11
Reviewed by Brian Burg.

This gets us down to about 0.5% of time.

* UserInterface/Views/TimelineRecordBar.js:
(WebInspector.TimelineRecordBar.prototype.set records):
Only modify the classLists when the record changes.

(WebInspector.TimelineRecordBar.prototype.refresh):
Set unfinished once for either the uses active or not uses active cases.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (200739 => 200740)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-12 03:17:25 UTC (rev 200739)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-12 04:32:54 UTC (rev 200740)
@@ -1,5 +1,21 @@
 2016-05-11  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: 4% of time in TimelineOverviewGraph adding/removing classList styles on TimelineRecordBar
+        https://bugs.webkit.org/show_bug.cgi?id=157607
+
+        Reviewed by Brian Burg.
+
+        This gets us down to about 0.5% of time.
+
+        * UserInterface/Views/TimelineRecordBar.js:
+        (WebInspector.TimelineRecordBar.prototype.set records):
+        Only modify the classLists when the record changes.
+
+        (WebInspector.TimelineRecordBar.prototype.refresh):
+        Set unfinished once for either the uses active or not uses active cases.
+
+2016-05-11  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: Unexpected unread notification icon next to Log after clearing via clear()
         https://bugs.webkit.org/show_bug.cgi?id=157598
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js (200739 => 200740)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js	2016-05-12 03:17:25 UTC (rev 200739)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js	2016-05-12 04:32:54 UTC (rev 200740)
@@ -190,23 +190,35 @@
 
     set records(records)
     {
+        let oldRecordType;
+        let oldRecordEventType;
+        let oldRecordUsesActiveStartTime = false;
         if (this._records && this._records.length) {
-            this._element.classList.remove(this._records[0].type);
-            if (this._records[0].eventType)
-                this._element.classList.remove(this._records[0].eventType);
+            let oldRecord = this._records[0];
+            oldRecordType = oldRecord.type;
+            oldRecordEventType = oldRecord.eventType;
+            oldRecordUsesActiveStartTime = oldRecord.usesActiveStartTime;
         }
 
         records = records || [];
 
         this._records = records;
 
-        // Assume all records are the same type.
+        // Assume all records in the group are the same type.
         if (this._records.length) {
-            this._element.classList.add(this._records[0].type);
+            let newRecord = this._records[0];
+            if (newRecord.type !== oldRecordType) {
+                this._element.classList.remove(oldRecordType);
+                this._element.classList.add(newRecord.type);
+            }
             // Although all records may not have the same event type, the first record is
             // sufficient to determine the correct style for the record bar.
-            if (this._records[0].eventType)
-                this._element.classList.add(this._records[0].eventType);
+            if (newRecord.eventType !== oldRecordEventType) {
+                this._element.classList.remove(oldRecordEventType);
+                this._element.classList.add(newRecord.eventType);
+            }
+            if (newRecord.usesActiveStartTime !== oldRecordUsesActiveStartTime)
+                this._element.classList.toggle("has-inactive-segment", newRecord.usesActiveStartTime);
         }
     }
 
@@ -242,8 +254,6 @@
 
         var graphDuration = graphEndTime - graphStartTime;
 
-        this._element.classList.toggle("unfinished", barUnfinished);
-
         var newBarLeftPosition = (barStartTime - graphStartTime) / graphDuration;
         this._updateElementPosition(this._element, newBarLeftPosition, "left");
 
@@ -256,7 +266,7 @@
         }
 
         if (!firstRecord.usesActiveStartTime) {
-            this._element.classList.remove("has-inactive-segment");
+            this._element.classList.toggle("unfinished", barUnfinished);
 
             if (this._inactiveBarElement)
                 this._inactiveBarElement.remove();
@@ -278,8 +288,6 @@
             return true;
         }
 
-        this._element.classList.add("has-inactive-segment");
-
         // Find the earliest active start time for active only rendering, and the latest for the other modes.
         // This matches the values that TimelineRecordBar.createCombinedBars uses when combining.
         if (this._renderMode === WebInspector.TimelineRecordBar.RenderMode.ActiveOnly)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to