⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 248996 in webkit


Ignore:
Timestamp:
Aug 21, 2019, 10:51:53 PM (7 years ago)
Author:
rniwa@webkit.org
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:
Location:
trunk/LayoutTests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248993 r248996  
     12019-08-21  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Layout Test perf/clone-with-focus.html is a Flaky Failure
     4        https://bugs.webkit.org/show_bug.cgi?id=201012
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The flakiness was observed when the time to clone elements without focus is 0ms
     9        but the time to clone elements with focus is 1ms or greater.
     10
     11        The test tries to make sure the time to clone elements with foucs is less than 2x
     12        of the time to clone elements without focus. When the time to clone without focus
     13        is 0ms, any difference is always more than 2x larger.
     14
     15        Fixed the test by increasing the number of elements until the time to clone without
     16        focus takes at least 5ms.
     17
     18        * perf/clone-with-focus.html:
     19
    1202019-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
    221
  • trunk/LayoutTests/perf/clone-with-focus.html

    r120417 r248996  
    1818            if (focusInput)
    1919                inputElement.focus();
    20                
    21             var startTime = Date.now();
     20
     21            var startTime = performance.now();
    2222            for (var i = 0; i < numberOfElements; i++) {
    2323                var clone = templateElement.cloneNode(true);
     
    2525                listElement.appendChild(clone);
    2626            }
    27             var endTime = Date.now();
    28            
     27            var endTime = performance.now();
     28
    2929            if (focusInput)
    3030                inputElement.blur();
    31                
    32             while (listElement.firstChild != listElement.lastChild)
    33                 listElement.removeChild(listElement.lastChild);
    34            
     31
     32            const originalItem = listElement.firstChild;
     33            listElement.textContent = '';
     34            listElement.appendChild(originalItem);
     35
    3536            return endTime - startTime;
    3637        }
     
    4344        }
    4445
    45         var timeWithoutFocus = test(1000, false);
    46         var timeWithFocus = test(1000, true);
     46        const start = performance.now();
     47        let factor = 0;
     48        while (test(1000 * factor, false) < 5)
     49            factor++;
     50
     51        var timeWithoutFocus = test(1000 * factor, false);
     52        var timeWithFocus = test(1000 * factor, true);
    4753
    4854        if (Math.abs(timeWithFocus - timeWithoutFocus) <= timeWithoutFocus) {
Note: See TracChangeset for help on using the changeset viewer.