4 <title>DoYouEvenBench v0.9</title>
5 <style type="text/css">
6 caption { margin: 0; padding: 0; font-family: sans-serif; font-size: 1em; font-weight: bold; white-space: nowrap; }
7 #progressContainer { padding: 605px 0 10px 0; width: 800px; }
8 #progressContainer div { background-color: #ccc; width: 0; height: 5px; overflow: hidden; }
9 table { font-family: sans-serif; }
10 table, td, th { border: solid 1px #ccc; border-collapse: collapse; padding: 5px; }
11 th { text-align: right; }
12 td { text-align: left; }
18 var resultContainer = null;
20 var progressContainer;
22 var iterationNumber = 0;
23 var finishedTestCount = 0;
25 function addResult(title, value) {
26 if (!resultContainer) {
27 resultContainer = document.createElement('table');
28 var caption = document.createElement('caption');
29 caption.textContent = document.title;
30 resultContainer.appendChild(caption);
31 document.body.appendChild(resultContainer);
35 var row = document.createElement('tr');
36 var th = document.createElement('th');
37 th.textContent = title;
38 var td = document.createElement('td');
39 td.textContent = value;
42 resultContainer.appendChild(row);
45 window.benchmarkClient = {
46 willRunTest: function () {
48 // We don't use the real progress element as some implementations animate it.
49 progressContainer = document.createElement('div');
50 progressContainer.appendChild(document.createElement('div'));
51 progressContainer.id = 'progressContainer';
52 document.body.appendChild(progressContainer);
53 progress = progressContainer.firstChild;
57 didRunTest: function () {
59 progress.style.width = (finishedTestCount * 100 / this.testsCount) + '%';
61 didRunSuites: function (measuredValues) {
62 values.push(measuredValues.total);
64 addResult('Iteration ' + iterationNumber, measuredValues.total.toFixed(2) + ' ms');
66 didFinishLastIteration: function () {
67 var sum = values.reduce(function (a, b) { return a + b; }, 0);
68 var arithmeticMean = sum / values.length;
69 addResult('Arithmetic Mean', arithmeticMean.toFixed(2) + 'ms');
70 if (window.Statistics) {
71 var delta = Statistics.confidenceIntervalDelta(0.95, values.length, sum, Statistics.squareSum(values));
72 var precentDelta = delta * 100 / arithmeticMean;
73 addResult('95th Percentile', delta.toFixed(2) + ' ms (' + precentDelta.toFixed(2) + '%)');
75 progressContainer.parentNode.removeChild(progressContainer);
80 function startTest() {
81 var iterationCount = 5;
82 benchmarkClient.testsCount = iterationCount * Suites.reduce(function (testsCount, suite) { return testsCount + suite.tests.length; }, 0);
83 var runner = new BenchmarkRunner(Suites, benchmarkClient);
84 runner.runMultipleIterations(iterationCount);
88 <script src="resources/benchmark-runner.js"></script>
89 <script src="resources/benchmark-report.js"></script>
90 <script src="../resources/statistics.js"></script>
91 <script src="resources/tests.js"></script>
93 <body onload="startTest()">