Title: [171361] trunk/Websites/perf.webkit.org
Revision
171361
Author
rn...@webkit.org
Date
2014-07-22 13:57:54 -0700 (Tue, 22 Jul 2014)

Log Message

Perf dashboard spends 2s processing JSON data during the page loads
https://bugs.webkit.org/show_bug.cgi?id=135152

Reviewed by Andreas Kling.

In the Apple internal dashboard, we were spending as much as 2 seconds
converting raw JSON data into proper JS objects while loading the dashboard.

This caused the apparent unresponsiveness of the dashboard despite of the fact
charts themselves updated almost instantaneously.

* public/index.html:
* public/js/helper-classes.js:
(TestBuild): Compute the return values of formattedTime and formattedBuildTime
lazily as creating new Date objects and running string replace is expensive.
(TestBuild.formattedTime):
(TestBuild.formattedBuildTime):
(PerfTestRuns.setResults): Added. Pushing each result was the biggest bottle neck.
(PerfTestRuns.addResult): Deleted.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (171360 => 171361)


--- trunk/Websites/perf.webkit.org/ChangeLog	2014-07-22 20:51:13 UTC (rev 171360)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2014-07-22 20:57:54 UTC (rev 171361)
@@ -1,3 +1,25 @@
+2014-07-22  Ryosuke Niwa  <rn...@webkit.org>
+
+        Perf dashboard spends 2s processing JSON data during the page loads
+        https://bugs.webkit.org/show_bug.cgi?id=135152
+
+        Reviewed by Andreas Kling.
+
+        In the Apple internal dashboard, we were spending as much as 2 seconds
+        converting raw JSON data into proper JS objects while loading the dashboard.
+
+        This caused the apparent unresponsiveness of the dashboard despite of the fact
+        charts themselves updated almost instantaneously.
+
+        * public/index.html:
+        * public/js/helper-classes.js:
+        (TestBuild): Compute the return values of formattedTime and formattedBuildTime
+        lazily as creating new Date objects and running string replace is expensive.
+        (TestBuild.formattedTime):
+        (TestBuild.formattedBuildTime):
+        (PerfTestRuns.setResults): Added. Pushing each result was the biggest bottle neck.
+        (PerfTestRuns.addResult): Deleted.
+
 2014-07-18  Ryosuke Niwa  <rn...@webkit.org>
 
         Perf dashboard shouldn't show the full git hash

Modified: trunk/Websites/perf.webkit.org/public/index.html (171360 => 171361)


--- trunk/Websites/perf.webkit.org/public/index.html	2014-07-22 20:51:13 UTC (rev 171360)
+++ trunk/Websites/perf.webkit.org/public/index.html	2014-07-22 20:57:54 UTC (rev 171361)
@@ -835,8 +835,7 @@
             // We should create PerfTestResult on demand.
             return new PerfTestResult(runs, rawRun, new TestBuild(repositories, builders, platform, rawRun));
         });
-        sortedResults = results.sort(function (a, b) { return a.build().time() - b.build().time(); });
-        sortedResults.forEach(function (result) { runs.addResult(result); });
+        runs.setResults(results.sort(function (a, b) { return a.build().time() - b.build().time(); }));
         return runs;
     }
 

Modified: trunk/Websites/perf.webkit.org/public/js/helper-classes.js (171360 => 171361)


--- trunk/Websites/perf.webkit.org/public/js/helper-classes.js	2014-07-22 20:51:13 UTC (rev 171360)
+++ trunk/Websites/perf.webkit.org/public/js/helper-classes.js	2014-07-22 20:57:54 UTC (rev 171361)
@@ -58,14 +58,22 @@
     if (!maxTime)
         maxTime = rawRun.buildTime;
     maxTime = TestBuild.UTCtoPST(maxTime);
-    var maxTimeString = new Date(maxTime).toISOString().replace('T', ' ').replace(/\.\d+Z$/, '');
+    var maxTimeString;
     var buildTime = TestBuild.UTCtoPST(rawRun.buildTime);
-    var buildTimeString = new Date(buildTime).toISOString().replace('T', ' ').replace(/\.\d+Z$/, '');
+    var buildTimeString;
 
     this.time = function () { return maxTime; }
-    this.formattedTime = function () { return maxTimeString; }
+    this.formattedTime = function () {
+        if (!maxTimeString)
+            maxTimeString = new Date(maxTime).toISOString().replace('T', ' ').replace(/\.\d+Z$/, '');
+        return maxTimeString;
+    }
     this.buildTime = function () { return buildTime; }
-    this.formattedBuildTime = function () { return buildTimeString; }
+    this.formattedBuildTime = function () {
+        if (!buildTimeString)
+            new Date(buildTime).toISOString().replace('T', ' ').replace(/\.\d+Z$/, '');
+        return buildTimeString;
+    }
     this.builder = function () { return builders[rawRun.builder].name; }
     this.buildNumber = function () { return rawRun.buildNumber; }
     this.buildUrl = function () {
@@ -178,10 +186,8 @@
 
     this.metric = function () { return metric; }
     this.platform = function () { return platform; }
-    this.addResult = function (newResult) {
-        if (results.indexOf(newResult) >= 0)
-            return;
-        results.push(newResult);
+    this.setResults = function (newResults) {
+        results = newResults;
         cachedUnit = null;
         cachedScalingFactor = null;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to