Optimize bot watcher's dashboard a little
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2016 21:07:21 +0000 (21:07 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2016 21:07:21 +0000 (21:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160515
rdar://problem/26096900

Reviewed by Lucas Forschler.

Made re-sorting after loading an iteration more efficient.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
(BuildbotIteration.prototype._updateWithData):
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
(BuildbotQueue.prototype.updateIterationPosition):

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

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js
Tools/ChangeLog

index a2a8fae..33271cd 100644 (file)
@@ -303,7 +303,7 @@ BuildbotIteration.prototype = {
         this._parseData(data);
 
         // Update the sorting since it is based on the revision numbers that just became known.
-        this.queue.sortIterations();
+        this.queue.updateIterationPosition(this);
 
         this.dispatchEventToListeners(BuildbotIteration.Event.Updated);
     },
index 1bed621..43f8a3c 100644 (file)
@@ -299,6 +299,28 @@ BuildbotQueue.prototype = {
         return 0;
     },
 
+    // Re-insert the iteration if its sort order changed (which happens once details about it get loaded).
+    updateIterationPosition: function(iteration)
+    {
+        var oldIndex;
+        var inserted = false;
+        for (var i = 0; i < this.iterations.length; ++i) {
+            if (!inserted && this.compareIterations(this.iterations[i], iteration) > 0) {
+                this.iterations.splice(i, 0, iteration);
+                if (oldIndex !== undefined)
+                    break;
+                inserted = true;
+                continue;
+            }
+            if (this.iterations[i] === iteration) {
+                oldIndex = i;
+                if (inserted)
+                    break;
+            }
+        }
+        this.iterations.splice(oldIndex, 1);
+    },
+
     sortIterations: function()
     {
         this.iterations.sort(this.compareIterations.bind(this));
index eb09000..1caf3d9 100644 (file)
@@ -1,3 +1,18 @@
+2016-08-04  Alexey Proskuryakov  <ap@apple.com>
+
+        Optimize bot watcher's dashboard a little
+        https://bugs.webkit.org/show_bug.cgi?id=160515
+        rdar://problem/26096900
+
+        Reviewed by Lucas Forschler.
+
+        Made re-sorting after loading an iteration more efficient.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
+        (BuildbotIteration.prototype._updateWithData):
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
+        (BuildbotQueue.prototype.updateIterationPosition):
+
 2016-08-04  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Unable to reliably run tests in parallel