From: ager@chromium.org Date: Tue, 13 Jan 2009 09:27:47 +0000 (+0000) Subject: Fix benchmarks to not format scores that are really errors. X-Git-Tag: upstream/4.7.83~24810 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c56f0dd9ae6a2e225824417eee2b7faa83934b5;p=platform%2Fupstream%2Fv8.git Fix benchmarks to not format scores that are really errors. Uploading for Kasper. Review URL: http://codereview.chromium.org/17641 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1061 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/benchmarks/base.js b/benchmarks/base.js index 5afc110d3..6e1ff8cc7 100644 --- a/benchmarks/base.js +++ b/benchmarks/base.js @@ -120,7 +120,8 @@ BenchmarkSuite.RunSuites = function(runner) { } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); - runner.NotifyScore(100 * score); + var formatted = BenchmarkSuite.FormatScore(100 * score); + runner.NotifyScore(formatted); } } RunStep(); @@ -149,6 +150,16 @@ BenchmarkSuite.GeometricMean = function(numbers) { } +// Converts a score value to a string with at least three significant +// digits. +BenchmarkSuite.FormatScore = function(value) { + if (value > 100) { + return value.toFixed(0); + } else { + return value.toPrecision(3); + } +} + // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { @@ -164,7 +175,8 @@ BenchmarkSuite.prototype.NotifyResult = function() { var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { - this.runner.NotifyResult(this.name, 100 * score); + var formatted = BenchmarkSuite.FormatScore(100 * score); + this.runner.NotifyResult(this.name, formatted); } } @@ -219,14 +231,3 @@ BenchmarkSuite.prototype.RunStep = function(runner) { } return RunNext(); } - - -// Converts a score value to a string with at least three significant -// digits. -function formatScore(value) { - if (value > 100) { - return value.toFixed(0); - } else { - return value.toPrecision(3); - } -} diff --git a/benchmarks/run.html b/benchmarks/run.html index d521e0b37..01cadc0d2 100644 --- a/benchmarks/run.html +++ b/benchmarks/run.html @@ -21,7 +21,7 @@ function ShowProgress(name) { function AddResult(name, result) { - var text = name + ': ' + formatScore(result); + var text = name + ': ' + result; var results = document.getElementById("results"); results.innerHTML += (text + "
"); } @@ -36,7 +36,7 @@ function AddError(name, error) { function AddScore(score) { var status = document.getElementById("status"); if (success) { - status.innerHTML = "Score: " + formatScore(score); + status.innerHTML = "Score: " + score; } } diff --git a/benchmarks/run.js b/benchmarks/run.js index ecfee90c6..da2373b84 100644 --- a/benchmarks/run.js +++ b/benchmarks/run.js @@ -36,7 +36,7 @@ load('earley-boyer.js'); var success = true; function PrintResult(name, result) { - print(name + ': ' + formatScore(result)); + print(name + ': ' + result); } @@ -49,8 +49,7 @@ function PrintError(name, error) { function PrintScore(score) { if (success) { print('----'); - print('Score (version ' + BenchmarkSuite.version + '): ' - + formatScore(score)); + print('Score (version ' + BenchmarkSuite.version + '): ' + score); } }