Merge Speedometer 2.0 fixes up to r217121 to browserbench.org
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 May 2017 22:17:49 +0000 (22:17 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 May 2017 22:17:49 +0000 (22:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172389

Rubber-stamped by Chris Dumez.

Merged the various fixes for Speedometer 2.0 starting from r217107 through r217121.

* Speedometer2.0/InteractiveRunner.html:
* Speedometer2.0/resources/benchmark-runner.js:
* Speedometer2.0/resources/tests.js:
* Speedometer2.0/resources/todomvc/dependency-examples/flight/flight/app/js/main.js:
* Speedometer2.0/resources/todomvc/dependency-examples/flight/flight/node_modules/requirejs/require.js:
* Speedometer2.0/resources/todomvc/functional-prog-examples/elm/dist/elm.js:
* Speedometer2.0/resources/todomvc/vanilla-examples/vanillajs/js/store.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217154 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/browserbench.org/ChangeLog
Websites/browserbench.org/Speedometer2.0/InteractiveRunner.html
Websites/browserbench.org/Speedometer2.0/resources/benchmark-runner.js
Websites/browserbench.org/Speedometer2.0/resources/tests.js
Websites/browserbench.org/Speedometer2.0/resources/todomvc/dependency-examples/flight/flight/app/js/main.js
Websites/browserbench.org/Speedometer2.0/resources/todomvc/dependency-examples/flight/flight/node_modules/requirejs/require.js
Websites/browserbench.org/Speedometer2.0/resources/todomvc/functional-prog-examples/elm/dist/elm.js
Websites/browserbench.org/Speedometer2.0/resources/todomvc/vanilla-examples/vanillajs/js/store.js

index c433943..9235fe1 100644 (file)
@@ -1,3 +1,20 @@
+2017-05-19  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Merge Speedometer 2.0 fixes up to r217121 to browserbench.org
+        https://bugs.webkit.org/show_bug.cgi?id=172389
+
+        Rubber-stamped by Chris Dumez.
+
+        Merged the various fixes for Speedometer 2.0 starting from r217107 through r217121.
+
+        * Speedometer2.0/InteractiveRunner.html:
+        * Speedometer2.0/resources/benchmark-runner.js:
+        * Speedometer2.0/resources/tests.js:
+        * Speedometer2.0/resources/todomvc/dependency-examples/flight/flight/app/js/main.js:
+        * Speedometer2.0/resources/todomvc/dependency-examples/flight/flight/node_modules/requirejs/require.js:
+        * Speedometer2.0/resources/todomvc/functional-prog-examples/elm/dist/elm.js:
+        * Speedometer2.0/resources/todomvc/vanilla-examples/vanillajs/js/store.js:
+
 2017-05-18  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add Speedometer 2.0 to browserbench.org for final testing
index 7e5fe2a..6cc761e 100644 (file)
@@ -10,7 +10,8 @@ ol { list-style: none; margin: 0; padding: 0; }
 ol ol { margin-left: 2em; list-position: outside; }
 .running { text-decoration: underline; }
 .ran { color: grey; }
-nav { position: absolute; right: 10px; }
+nav { position: absolute; right: 10px; height: 600px; }
+nav > ol { height: 100%; overflow-y: scroll; }
 </style>
 </head>
 <body>
index 36c03c4..55bd570 100644 (file)
@@ -192,6 +192,7 @@ BenchmarkRunner.prototype.step = function (state) {
     }
 
     if (state.isFirstTest()) {
+        this._removeFrame();
         this._masuredValuesForCurrentSuite = {};
         var self = this;
         return state.prepareCurrentSuite(this, this._appendFrame()).then(function (prepareReturnValue) {
@@ -251,8 +252,6 @@ BenchmarkRunner.prototype._runTestAndRecordResults = function (state) {
                 self._client.didRunTest(suite, test);
 
             state.next();
-            if (state.currentSuite() != suite)
-                self._removeFrame();
             promise.resolve(state);
         });
     }, 0);
index dc59f8f..dd9a6fa 100644 (file)
@@ -250,9 +250,8 @@ Suites.push({
                 checkboxes[i].click();
         }),
         new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
-            var deleteButtons = contentDocument.querySelectorAll('.destroy');
-            for (var i = 0; i < deleteButtons.length; i++)
-                deleteButtons[i].click();
+            for (var i = 0; i < numberOfItemsToAdd; i++)
+                contentDocument.querySelector('.destroy').click();
         }),
     ]
 });
@@ -340,14 +339,13 @@ Suites.push({
             }
         }),
         new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
-            var checkboxes = contentDocument.querySelectorAll('.toggle');
+            var checkboxes = contentDocument.getElementsByClassName('toggle');
             for (var i = 0; i < checkboxes.length; i++)
                 checkboxes[i].click();
         }),
         new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
-            var deleteButtons = contentDocument.querySelectorAll('.destroy');
-            for (var i = 0; i < deleteButtons.length; i++)
-                deleteButtons[i].click();
+            for (var i = 0; i < numberOfItemsToAdd; i++)
+                contentDocument.querySelector('.destroy').click();
         }),
     ]
 })
@@ -408,12 +406,24 @@ Suites.push({
         }),
         new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
             var deleteButtons = contentDocument.querySelectorAll('.destroy');
-            for (var i = 0; i < deleteButtons.length; i++)
-                deleteButtons[i].click();
+            for (var i = 0; i < numberOfItemsToAdd; i++)
+                contentDocument.querySelector('.destroy').click();
         }),
     ]
 });
 
+function processElmWorkQueue(contentWindow)
+{
+    contentWindow.elmWork();
+    var callbacks = contentWindow.rAFCallbackList;
+    var i = 0;
+    while (i < callbacks.length) {
+        callbacks[i]();
+        i++;
+    }
+    contentWindow.rAFCallbackList = [];
+}
+
 Suites.push({
     name: 'Elm-TodoMVC',
     url: 'todomvc/functional-prog-examples/elm/index.html',
@@ -431,18 +441,23 @@ Suites.push({
                   bubbles: true,
                   cancelable: true
                 }));
+                processElmWorkQueue(contentWindow);
                 triggerEnter(newTodo, 'keydown');
+                processElmWorkQueue(contentWindow);
             }
         }),
         new BenchmarkTestStep('CompletingAllItems', function (params, contentWindow, contentDocument) {
             var checkboxes = contentDocument.querySelectorAll('.toggle');
-            for (var i = 0; i < checkboxes.length; i++)
+            for (var i = 0; i < checkboxes.length; i++) {
                 checkboxes[i].click();
+                processElmWorkQueue(contentWindow);
+            }
         }),
         new BenchmarkTestStep('DeletingItems', function (params, contentWindow, contentDocument) {
-            var deleteButtons = contentDocument.querySelectorAll('.destroy');
-            for (var i = 0; i < deleteButtons.length; i++)
-                deleteButtons[i].click();
+            for (var i = 0; i < numberOfItemsToAdd; i++) {
+                contentDocument.querySelector('.destroy').click();
+                processElmWorkQueue(contentWindow);
+            }
         }),
     ]
 });
@@ -451,9 +466,10 @@ Suites.push({
     name: 'Flight-TodoMVC',
     url: 'todomvc/dependency-examples/flight/flight/index.html',
     prepare: function (runner, contentWindow, contentDocument) {
-        return runner.waitForElement('#new-todo').then(function (element) {
-            element.focus();
-            return element;
+        return runner.waitForElement('#appIsReady').then(function (element) {
+            var newTodo = contentDocument.getElementById('new-todo');
+            newTodo.focus();
+            return newTodo;
         });
     },
     tests: [
index 464773f..79dd75c 100644 (file)
@@ -23,9 +23,20 @@ require.config({
     }
 });
 
+function checkReady(count) {
+    if (window.checkLoadedTimeoutId)
+        return setTimeout(checkReady.bind(this, 0), 50);
+    if (count < 5)
+        return setTimeout(checkReady.bind(this, count + 1), 10);
+
+    var dummyNodeToNotifyAppIsReady = document.createElement('div');
+    dummyNodeToNotifyAppIsReady.id = 'appIsReady';
+    document.body.appendChild(dummyNodeToNotifyAppIsReady);
+}
+
 require([], function () {
     require(['app/page/app'],function(App){
         App.initialize();
-        console.log(App);
+        checkReady(0);
     });
 });
index 0fc1082..e1b56d3 100644 (file)
@@ -718,6 +718,7 @@ var requirejs, require, define;
                         checkLoadedTimeoutId = 0;
                         checkLoaded();
                     }, 50);
+                    window.checkLoadedTimeoutId = checkLoadedTimeoutId;
                 }
             }
 
index 57b97c5..a55ea9d 100644 (file)
@@ -2678,7 +2678,7 @@ function work()
     }
     setTimeout(work, 0);
 }
-
+window.elmWork = work;
 
 return {
     succeed: succeed,
@@ -7009,9 +7009,7 @@ function on(node)
     };
 }
 
-var rAF = typeof requestAnimationFrame !== 'undefined'
-    ? requestAnimationFrame
-    : function(callback) { callback(); };
+var rAF = function(callback) { callback(); };
 
 function withNode(id, doStuff)
 {
@@ -7485,10 +7483,10 @@ function renderer(parent, tagger, initialVirtualNode)
 }
 
 
-var rAF =
-    typeof requestAnimationFrame !== 'undefined'
-        ? requestAnimationFrame
-        : function(cb) { setTimeout(cb, 1000 / 60); };
+window.rAFCallbackList = [];
+var rAF = function (callback) {
+    window.rAFCallbackList.push(callback);
+}
 
 
 
index fe682c8..b520514 100644 (file)
@@ -3,6 +3,8 @@
     'use strict';
 
     var MemoryStorage = {};
+    var id = 1;
+
     /**
      * Creates a new client side storage object and will create an empty
      * collection if no collection already exists.
@@ -96,7 +98,7 @@
             callback.call(this, todos);
         } else {
             // Generate an ID
-            updateData.id = new Date().getTime();
+            updateData.id = id++;
 
             todos.push(updateData);
             MemoryStorage[this._dbName] = JSON.stringify(data);