Title: [192455] trunk/PerformanceTests
Revision
192455
Author
commit-qu...@webkit.org
Date
2015-11-13 21:51:27 -0800 (Fri, 13 Nov 2015)

Log Message

Eliminate a request for layout every time an item is added to the stage of the graphics benchmark
https://bugs.webkit.org/show_bug.cgi?id=151289

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2015-11-13
Reviewed by Simon Fraser.

Cache the stage size when it is created instead of requesting every time
an object is added via clientWidth and clientHeight.

* Animometer/resources/extensions.js:
(Insets.elementPadding):
* Animometer/tests/resources/stage.js:
(Stage):
(Stage.prototype.get size):

Modified Paths

Diff

Modified: trunk/PerformanceTests/Animometer/resources/extensions.js (192454 => 192455)


--- trunk/PerformanceTests/Animometer/resources/extensions.js	2015-11-14 04:03:14 UTC (rev 192454)
+++ trunk/PerformanceTests/Animometer/resources/extensions.js	2015-11-14 05:51:27 UTC (rev 192455)
@@ -68,6 +68,16 @@
     this.left = left;
 }
 
+Insets.elementPadding = function(element)
+{
+    var styles = window.getComputedStyle(element);
+    return new Insets(
+        parseFloat(styles.paddingTop),
+        parseFloat(styles.paddingRight),
+        parseFloat(styles.paddingBottom),
+        parseFloat(styles.paddingTop));
+}
+
 Insets.prototype =
 {
     get width()

Modified: trunk/PerformanceTests/Animometer/tests/resources/stage.js (192454 => 192455)


--- trunk/PerformanceTests/Animometer/tests/resources/stage.js	2015-11-14 04:03:14 UTC (rev 192454)
+++ trunk/PerformanceTests/Animometer/tests/resources/stage.js	2015-11-14 05:51:27 UTC (rev 192455)
@@ -35,19 +35,14 @@
 function Stage(element, options)
 {
     this.element = element;
+    this._size = Point.elementClientSize(element).subtract(Insets.elementPadding(element).size);
 }
 
 Stage.prototype =
 {
     get size()
     {
-        var styles = window.getComputedStyle(this.element);
-        var padding = new Insets(
-            parseFloat(styles.paddingTop),
-            parseFloat(styles.paddingRight),
-            parseFloat(styles.paddingBottom),
-            parseFloat(styles.paddingTop));
-        return new Point(this.element.clientWidth - padding.width, this.element.clientHeight - padding.height);
+        return this._size
     },
     
     random: function(min, max)

Modified: trunk/PerformanceTests/ChangeLog (192454 => 192455)


--- trunk/PerformanceTests/ChangeLog	2015-11-14 04:03:14 UTC (rev 192454)
+++ trunk/PerformanceTests/ChangeLog	2015-11-14 05:51:27 UTC (rev 192455)
@@ -1,3 +1,19 @@
+2015-11-13  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Eliminate a request for layout every time an item is added to the stage of the graphics benchmark
+        https://bugs.webkit.org/show_bug.cgi?id=151289
+
+        Reviewed by Simon Fraser.
+        
+        Cache the stage size when it is created instead of requesting every time
+        an object is added via clientWidth and clientHeight.
+
+        * Animometer/resources/extensions.js:
+        (Insets.elementPadding):
+        * Animometer/tests/resources/stage.js:
+        (Stage):
+        (Stage.prototype.get size):
+
 2015-11-06  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Initialize the graphics benchmark's Kalman filter with estimated 60 FPS
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to