Title: [248996] trunk/LayoutTests
Revision
248996
Author
rn...@webkit.org
Date
2019-08-21 22:51:53 -0700 (Wed, 21 Aug 2019)

Log Message

Layout Test perf/clone-with-focus.html is a Flaky Failure
https://bugs.webkit.org/show_bug.cgi?id=201012

Reviewed by Antti Koivisto.

The flakiness was observed when the time to clone elements without focus is 0ms
but the time to clone elements with focus is 1ms or greater.

The test tries to make sure the time to clone elements with foucs is less than 2x
of the time to clone elements without focus. When the time to clone without focus
is 0ms, any difference is always more than 2x larger.

Fixed the test by increasing the number of elements until the time to clone without
focus takes at least 5ms.

* perf/clone-with-focus.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (248995 => 248996)


--- trunk/LayoutTests/ChangeLog	2019-08-22 05:33:33 UTC (rev 248995)
+++ trunk/LayoutTests/ChangeLog	2019-08-22 05:51:53 UTC (rev 248996)
@@ -1,3 +1,22 @@
+2019-08-21  Ryosuke Niwa  <rn...@webkit.org>
+
+        Layout Test perf/clone-with-focus.html is a Flaky Failure
+        https://bugs.webkit.org/show_bug.cgi?id=201012
+
+        Reviewed by Antti Koivisto.
+
+        The flakiness was observed when the time to clone elements without focus is 0ms
+        but the time to clone elements with focus is 1ms or greater.
+
+        The test tries to make sure the time to clone elements with foucs is less than 2x
+        of the time to clone elements without focus. When the time to clone without focus
+        is 0ms, any difference is always more than 2x larger.
+
+        Fixed the test by increasing the number of elements until the time to clone without
+        focus takes at least 5ms.
+
+        * perf/clone-with-focus.html:
+
 2019-08-21  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [WHLSL] Vertex shader and fragment shader need to be able to come from two different programs

Modified: trunk/LayoutTests/perf/clone-with-focus.html (248995 => 248996)


--- trunk/LayoutTests/perf/clone-with-focus.html	2019-08-22 05:33:33 UTC (rev 248995)
+++ trunk/LayoutTests/perf/clone-with-focus.html	2019-08-22 05:51:53 UTC (rev 248996)
@@ -17,21 +17,22 @@
         {
             if (focusInput)
                 inputElement.focus();
-                
-            var startTime = Date.now();
+
+            var startTime = performance.now();
             for (var i = 0; i < numberOfElements; i++) {
                 var clone = templateElement.cloneNode(true);
                 clone.childNodes[0].textContent = i;
                 listElement.appendChild(clone);
             }
-            var endTime = Date.now();
-            
+            var endTime = performance.now();
+
             if (focusInput)
                 inputElement.blur();
-                
-            while (listElement.firstChild != listElement.lastChild)
-                listElement.removeChild(listElement.lastChild);
-            
+
+            const originalItem = listElement.firstChild;
+            listElement.textContent = '';
+            listElement.appendChild(originalItem);
+
             return endTime - startTime;
         }
 
@@ -42,9 +43,14 @@
             document.getElementById('console').appendChild(element);
         }
 
-        var timeWithoutFocus = test(1000, false);
-        var timeWithFocus = test(1000, true);
+        const start = performance.now();
+        let factor = 0;
+        while (test(1000 * factor, false) < 5)
+            factor++;
 
+        var timeWithoutFocus = test(1000 * factor, false);
+        var timeWithFocus = test(1000 * factor, true);
+
         if (Math.abs(timeWithFocus - timeWithoutFocus) <= timeWithoutFocus) {
             log('PASS. Cloning elements takes roughly as long with as without focus.');
         } else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to