+2014-07-22 Ryosuke Niwa <rniwa@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 <rniwa@webkit.org>
Perf dashboard shouldn't show the full git hash
// 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;
}
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 () {
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;
}