haikuwebkit/PerformanceTests/ARES-6/stats.js

123 lines
6.7 KiB
JavaScript
Raw Permalink Normal View History

ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
/*
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
"use strict";
class Stats {
It should be easy to run ES6SampleBench from the jsc shell https://bugs.webkit.org/show_bug.cgi?id=161085 Reviewed by Yusuke Suzuki. PerformanceTests: This patch makes ES6 sample bench runnable through the `jsc` shell. To do that, you need to be in the PerformanceTests/ES6SampleBench directory and run `jsc cli.js`. To make this work, the benchmark is now aware of being run in two modes: via the browser, and via the shell. Each entry point will set a variable `isInBrowser`, and the benchmark will do different things based on if that variable is true or false. * ES6SampleBench/Air/benchmark.js: * ES6SampleBench/Air/stress-test.js: * ES6SampleBench/Basic/benchmark.js: (runBenchmark): * ES6SampleBench/Basic/stress-test.js: * ES6SampleBench/air_benchmark.js: * ES6SampleBench/basic_benchmark.js: * ES6SampleBench/cli.js: Added. (return.doRun): (makeBenchmarkRunner): * ES6SampleBench/driver.js: (Driver): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate.window.setTimeout): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: (reportResult): * ES6SampleBench/index.html: * ES6SampleBench/results.js: (Results): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportError): * ES6SampleBench/stats.js: (Stats): (Stats.prototype.toString): (Stats.prototype._update): Source/JavaScriptCore: This patch adds a new function called `runString` to the shell. It takes in a string, and executes it in a new global object. Then, it returns the global object it executed the code in. This allows the code to stash some kind of a result on the global, and then have the caller of `runString` extract the result. * jsc.cpp: (GlobalObject::finishCreation): (functionRunString): Canonical link: https://commits.webkit.org/179272@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-24 03:39:33 +00:00
constructor(cell, prefix)
ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
{
this._cell = cell;
this._data = [];
It should be easy to run ES6SampleBench from the jsc shell https://bugs.webkit.org/show_bug.cgi?id=161085 Reviewed by Yusuke Suzuki. PerformanceTests: This patch makes ES6 sample bench runnable through the `jsc` shell. To do that, you need to be in the PerformanceTests/ES6SampleBench directory and run `jsc cli.js`. To make this work, the benchmark is now aware of being run in two modes: via the browser, and via the shell. Each entry point will set a variable `isInBrowser`, and the benchmark will do different things based on if that variable is true or false. * ES6SampleBench/Air/benchmark.js: * ES6SampleBench/Air/stress-test.js: * ES6SampleBench/Basic/benchmark.js: (runBenchmark): * ES6SampleBench/Basic/stress-test.js: * ES6SampleBench/air_benchmark.js: * ES6SampleBench/basic_benchmark.js: * ES6SampleBench/cli.js: Added. (return.doRun): (makeBenchmarkRunner): * ES6SampleBench/driver.js: (Driver): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate.window.setTimeout): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: (reportResult): * ES6SampleBench/index.html: * ES6SampleBench/results.js: (Results): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportError): * ES6SampleBench/stats.js: (Stats): (Stats.prototype.toString): (Stats.prototype._update): Source/JavaScriptCore: This patch adds a new function called `runString` to the shell. It takes in a string, and executes it in a new global object. Then, it returns the global object it executed the code in. This allows the code to stash some kind of a result on the global, and then have the caller of `runString` extract the result. * jsc.cpp: (GlobalObject::finishCreation): (functionRunString): Canonical link: https://commits.webkit.org/179272@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-24 03:39:33 +00:00
this._prefix = "";
if (!isInBrowser && prefix) {
this._prefix = prefix + ": ";
if (this._prefix.length < 20)
this._prefix += " ".repeat(20 - this._prefix.length);
}
ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
}
reset(...data)
{
this._data = data;
this._update();
}
add(...data)
{
this._data.push(...data);
this._update();
}
get numIterations() { return this._data.length; }
valueForIteration(index) { return this._data[index]; }
get result()
{
var tDistribution = [NaN, NaN, 12.71, 4.30, 3.18, 2.78, 2.57, 2.45, 2.36, 2.31, 2.26, 2.23, 2.20, 2.18, 2.16, 2.14, 2.13, 2.12, 2.11, 2.10, 2.09, 2.09, 2.08, 2.07, 2.07, 2.06, 2.06, 2.06, 2.05, 2.05, 2.05, 2.04, 2.04, 2.04, 2.03, 2.03, 2.03, 2.03, 2.03, 2.02, 2.02, 2.02, 2.02, 2.02, 2.02, 2.02, 2.01, 2.01, 2.01, 2.01, 2.01, 2.01, 2.01, 2.01, 2.01, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 2.00, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.99, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.98, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.97, 1.96];
var tMax = tDistribution.length;
var tLimit = 1.96;
function tDist(n)
{
if (n > tMax)
return tLimit;
return tDistribution[n];
}
let sum = 0;
let n = 0;
for (let datum of this._data) {
sum += datum;
n++;
}
let mean = sum / n;
if (n <= 2)
return {n, mean};
let sumForStdDev = 0;
for (let datum of this._data)
sumForStdDev += Math.pow(datum - mean, 2);
let standardDeviation = Math.sqrt(sumForStdDev / (n - 1));
let standardError = standardDeviation / Math.sqrt(n);
let interval = tDist(n) * standardError;
return {n, mean, interval};
}
toString()
{
let result = this.result;
if (!result.n) {
if (isInBrowser)
return `<span class="value">\&#8709;</span><span class="units">ms</span>`;
return `${this._prefix}\&#x2b14;ms`;
}
ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
if (result.mean != result.mean)
return "ERROR";
if ("interval" in result) {
if (isInBrowser)
return `<span class="value">${this._prefix}${result.mean.toFixed(2)}</span><span class="margin"> &plusmn;${result.interval.toFixed(2)}</span><span class="units">ms</span>`;
return `${this._prefix}${result.mean.toFixed(2)} +- ${result.interval.toFixed(2)} ms`;
}
ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
if (isInBrowser)
return `<span class="value">${this._prefix}${result.mean.toFixed(2)}</span><span class="units">ms</span>`;
return `${this._prefix}${result.mean.toFixed(2)} ms`;
ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
}
_update()
{
It should be easy to run ES6SampleBench from the jsc shell https://bugs.webkit.org/show_bug.cgi?id=161085 Reviewed by Yusuke Suzuki. PerformanceTests: This patch makes ES6 sample bench runnable through the `jsc` shell. To do that, you need to be in the PerformanceTests/ES6SampleBench directory and run `jsc cli.js`. To make this work, the benchmark is now aware of being run in two modes: via the browser, and via the shell. Each entry point will set a variable `isInBrowser`, and the benchmark will do different things based on if that variable is true or false. * ES6SampleBench/Air/benchmark.js: * ES6SampleBench/Air/stress-test.js: * ES6SampleBench/Basic/benchmark.js: (runBenchmark): * ES6SampleBench/Basic/stress-test.js: * ES6SampleBench/air_benchmark.js: * ES6SampleBench/basic_benchmark.js: * ES6SampleBench/cli.js: Added. (return.doRun): (makeBenchmarkRunner): * ES6SampleBench/driver.js: (Driver): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate.window.setTimeout): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: (reportResult): * ES6SampleBench/index.html: * ES6SampleBench/results.js: (Results): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportError): * ES6SampleBench/stats.js: (Stats): (Stats.prototype.toString): (Stats.prototype._update): Source/JavaScriptCore: This patch adds a new function called `runString` to the shell. It takes in a string, and executes it in a new global object. Then, it returns the global object it executed the code in. This allows the code to stash some kind of a result on the global, and then have the caller of `runString` extract the result. * jsc.cpp: (GlobalObject::finishCreation): (functionRunString): Canonical link: https://commits.webkit.org/179272@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-24 03:39:33 +00:00
if (isInBrowser) {
if (this._cell)
this._cell.innerHTML = this.toString();
} else
print(this.toString());
ES6SampleBench should have a harness https://bugs.webkit.org/show_bug.cgi?id=159246 Reviewed by Saam Barati. This adds a simple web harness for ES6SampleBench. It runs Air and Basic 10 times for 200 iterations each and reports three metrics: First iteration: the time it takes for the first iteration to run. This is the first iteration after the benchmark is loaded into the iframe, so it's representative of what would happen if one of these workloads only ran for a short time. Worst 2%: of the last 199 iterations, the average of the worst 2% iterations. If code like any of these workloads was used in an important event handler, you'd want that code to run well in the worst case in addition to having great throughput. Steady state: the total of the last 199 iterations. This is representative of what would happen if you ran code like this for a long time. The total score is the geomean of the firstIteration/worstCase/steadyState numbers of the two benchmarks. The harness does statistics using Student's T-distribution confidence intervals. * ES6SampleBench/Basic/benchmark.js: (Benchmark): * ES6SampleBench/air_benchmark.js: Added. * ES6SampleBench/basic_benchmark.js: Added. * ES6SampleBench/driver.js: Added. (Driver): (Driver.prototype.addBenchmark): (Driver.prototype.start): (Driver.prototype.reportResult): (Driver.prototype.reportError): (Driver.prototype._recomputeSummary.Geomean): (Driver.prototype._recomputeSummary.Geomean.prototype.add): (Driver.prototype._recomputeSummary.Geomean.prototype.get result): (Driver.prototype._recomputeSummary): (Driver.prototype._iterate): (Driver.prototype._updateIterations): * ES6SampleBench/glue.js: Added. * ES6SampleBench/index.html: Added. * ES6SampleBench/results.js: Added. (Results): (Results.prototype.get benchmark): (Results.prototype.reset): (Results.prototype.reportRunning): (Results.prototype.reportDone): (Results.prototype.reportResult.averageAbovePercentile): (Results.prototype.reportResult): (Results.prototype.reportError): * ES6SampleBench/stats.js: Added. (Stats): (Stats.prototype.reset): (Stats.prototype.add): (Stats.prototype.get numIterations): (Stats.prototype.valueForIteration): (Stats.get result.tDist): (Stats.prototype.get result): (Stats.prototype.toString): (Stats.prototype._update): * ES6SampleBench/style.css: Added. (body): (body, th, tr): (h1, h2, h3, h4): (h1): (h2): (h3): (hr): (address): (img): (.underline): (ol.loweralpha): (ol.upperalpha): (ol.lowerroman): (ol.upperroman): (ol.arabic): (.banner-link:link, .banner-link:visited): (:link, :visited): (h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited): (.anchor:link, .anchor:visited): (* > .anchor:link, * > .anchor:visited): (span:hover .anchor): (a.forbidden, span.forbidden): (a.missing:hover): (a.closed:link, a.closed:visited, span.closed): (pre): (div.code): (div.code pre): (dt): (dd): (dd:last-child): (.site-logo): (.site-logo .tagline): (table): (#contents): (p): (p:last-child): (th): (td): Canonical link: https://commits.webkit.org/177360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-29 05:55:37 +00:00
}
}