Changeset 217119 in webkit


Ignore:
Timestamp:
May 19, 2017, 3:09:13 AM (8 years ago)
Author:
rniwa@webkit.org
Message:

Speedometer 2.0: Elem test isn't updating DOM during the measurement
https://bugs.webkit.org/show_bug.cgi?id=172343

Reviewed by Antti Koivisto.

Elem test wasn't doing much work because it simply enqueues items into the work queue, which doesn't get
executed until the next requestAnimationFrame or setTimeout callback happens.

Expose elm's work function as contentWindow.elemWork and make the first use of rAF a synchronous callback
just as it would when requestAnimationFrame isn't defined, and make the second use of rAF queue up to
an array of callbacks, and have the test runner manually invoke each callback.

This increases the runtime of the Elm suite from 100ms to 300ms on Safari.

  • Speedometer/resources/tests.js:

(processElmWorkQueue): Added. A helper which processes Elm's work queue and manually invokes render callbacks.

  • Speedometer/resources/todomvc/functional-prog-examples/elm/dist/elm.js:
Location:
trunk/PerformanceTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r217118 r217119  
     12017-05-19  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Speedometer 2.0: Elem test isn't updating DOM during the measurement
     4        https://bugs.webkit.org/show_bug.cgi?id=172343
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Elem test wasn't doing much work because it simply enqueues items into the work queue, which doesn't get
     9        executed until the next requestAnimationFrame or setTimeout callback happens.
     10
     11        Expose elm's work function as contentWindow.elemWork and make the first use of rAF a synchronous callback
     12        just as it would when requestAnimationFrame isn't defined, and make the second use of rAF queue up to
     13        an array of callbacks, and have the test runner manually invoke each callback.
     14
     15        This increases the runtime of the Elm suite from 100ms to 300ms on Safari.
     16
     17        * Speedometer/resources/tests.js:
     18        (processElmWorkQueue): Added. A helper which processes Elm's work queue and manually invokes render callbacks.
     19        * Speedometer/resources/todomvc/functional-prog-examples/elm/dist/elm.js:
     20
    1212017-05-18  Ryosuke Niwa  <rniwa@webkit.org>
    222
  • trunk/PerformanceTests/Speedometer/resources/tests.js

    r217118 r217119  
    414414});
    415415
     416function processElmWorkQueue(contentWindow)
     417{
     418    contentWindow.elmWork();
     419    var callbacks = contentWindow.rAFCallbackList;
     420    var i = 0;
     421    while (i < callbacks.length) {
     422        callbacks[i]();
     423        i++;
     424    }
     425    contentWindow.rAFCallbackList = [];
     426}
     427
    416428Suites.push({
    417429    name: 'Elm-TodoMVC',
     
    431443                  cancelable: true
    432444                }));
    433                 triggerEnter(newTodo, 'keydown');
    434             }
    435         }),
    436         new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
    437             var checkboxes = contentDocument.querySelectorAll('.toggle');
    438             for (var i = 0; i < checkboxes.length; i++)
    439                 checkboxes[i].click();
    440         }),
    441         new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
    442             var deleteButtons = contentDocument.querySelectorAll('.destroy');
    443             for (var i = 0; i < deleteButtons.length; i++)
    444                 deleteButtons[i].click();
     445                processElmWorkQueue(contentWindow);
     446                triggerEnter(newTodo, 'keydown');
     447                processElmWorkQueue(contentWindow);
     448            }
     449        }),
     450        new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
     451            var checkboxes = contentDocument.querySelectorAll('.toggle');
     452            for (var i = 0; i < checkboxes.length; i++) {
     453                checkboxes[i].click();
     454                processElmWorkQueue(contentWindow);
     455            }
     456        }),
     457        new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
     458            for (var i = 0; i < numberOfItemsToAdd; i++) {
     459                contentDocument.querySelector('.destroy').click();
     460                processElmWorkQueue(contentWindow);
     461            }
    445462        }),
    446463    ]
  • trunk/PerformanceTests/Speedometer/resources/todomvc/functional-prog-examples/elm/dist/elm.js

    r216717 r217119  
    26792679    setTimeout(work, 0);
    26802680}
    2681 
     2681window.elmWork = work;
    26822682
    26832683return {
     
    70107010}
    70117011
    7012 var rAF = typeof requestAnimationFrame !== 'undefined'
    7013     ? requestAnimationFrame
    7014     : function(callback) { callback(); };
     7012var rAF = function(callback) { callback(); };
    70157013
    70167014function withNode(id, doStuff)
     
    74867484
    74877485
    7488 var rAF =
    7489     typeof requestAnimationFrame !== 'undefined'
    7490         ? requestAnimationFrame
    7491         : function(cb) { setTimeout(cb, 1000 / 60); };
     7486window.rAFCallbackList = [];
     7487var rAF = function (callback) {
     7488    window.rAFCallbackList.push(callback);
     7489}
    74927490
    74937491
Note: See TracChangeset for help on using the changeset viewer.