Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: benchmarks/base.js

Issue 12865: Benchmark precision (Closed)
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | benchmarks/run.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (runner.NotifyStart) runner.NotifyStart(suite.name); 113 if (runner.NotifyStart) runner.NotifyStart(suite.name);
114 continuation = suite.RunStep(runner); 114 continuation = suite.RunStep(runner);
115 } 115 }
116 if (continuation && typeof window != 'undefined' && window.setTimeout) { 116 if (continuation && typeof window != 'undefined' && window.setTimeout) {
117 window.setTimeout(RunStep, 100); 117 window.setTimeout(RunStep, 100);
118 return; 118 return;
119 } 119 }
120 } 120 }
121 if (runner.NotifyScore) { 121 if (runner.NotifyScore) {
122 var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); 122 var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores);
123 runner.NotifyScore(Math.round(100 * score)); 123 runner.NotifyScore(100 * score);
sandholm 2008/12/02 12:54:16 Just wondering if it would make sense to always si
124 } 124 }
125 } 125 }
126 RunStep(); 126 RunStep();
127 } 127 }
128 128
129 129
130 // Counts the total number of registered benchmarks. Useful for 130 // Counts the total number of registered benchmarks. Useful for
131 // showing progress as a percentage. 131 // showing progress as a percentage.
132 BenchmarkSuite.CountBenchmarks = function() { 132 BenchmarkSuite.CountBenchmarks = function() {
133 var result = 0; 133 var result = 0;
(...skipping 23 matching lines...) Expand all
157 } 157 }
158 158
159 159
160 // Notifies the runner that we're done with running a suite and that 160 // Notifies the runner that we're done with running a suite and that
161 // we have a result which can be reported to the user if needed. 161 // we have a result which can be reported to the user if needed.
162 BenchmarkSuite.prototype.NotifyResult = function() { 162 BenchmarkSuite.prototype.NotifyResult = function() {
163 var mean = BenchmarkSuite.GeometricMean(this.results); 163 var mean = BenchmarkSuite.GeometricMean(this.results);
164 var score = this.reference / mean; 164 var score = this.reference / mean;
165 BenchmarkSuite.scores.push(score); 165 BenchmarkSuite.scores.push(score);
166 if (this.runner.NotifyResult) { 166 if (this.runner.NotifyResult) {
167 this.runner.NotifyResult(this.name, Math.round(100 * score)); 167 this.runner.NotifyResult(this.name, 100 * score);
168 } 168 }
169 } 169 }
170 170
171 171
172 // Notifies the runner that running a benchmark resulted in an error. 172 // Notifies the runner that running a benchmark resulted in an error.
173 BenchmarkSuite.prototype.NotifyError = function(error) { 173 BenchmarkSuite.prototype.NotifyError = function(error) {
174 if (this.runner.NotifyError) { 174 if (this.runner.NotifyError) {
175 this.runner.NotifyError(this.name, error); 175 this.runner.NotifyError(this.name, error);
176 } 176 }
177 if (this.runner.NotifyStep) { 177 if (this.runner.NotifyStep) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 suite.NotifyError(e); 212 suite.NotifyError(e);
213 return null; 213 return null;
214 } 214 }
215 return RunNext; 215 return RunNext;
216 } 216 }
217 suite.NotifyResult(); 217 suite.NotifyResult();
218 return null; 218 return null;
219 } 219 }
220 return RunNext(); 220 return RunNext();
221 } 221 }
222
223
224 // Converts a score value to a string with at least three significant
225 // digits.
226 function formatScore(value) {
227 if (value > 100) {
228 return value.toFixed(0);
229 } else {
230 return value.toPrecision(3);
231 }
232 }
OLDNEW
« no previous file with comments | « no previous file | benchmarks/run.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698