Reviewers: sandholm,

Description:
Changed benchmark runners to always display at least three significant
digits in the results.

Please review this at http://codereview.chromium.org/12865

Affected files:
   M benchmarks/base.js
   M benchmarks/run.html
   M benchmarks/run.js


Index: benchmarks/base.js
diff --git a/benchmarks/base.js b/benchmarks/base.js
index  
2c26132f7cd6354be98611f449b040beb65e2305..5afc110d3ffa8992b9c5833f90603b67a4b358dd
  
100644
--- a/benchmarks/base.js
+++ b/benchmarks/base.js
@@ -120,7 +120,7 @@ BenchmarkSuite.RunSuites = function(runner) {
      }
      if (runner.NotifyScore) {
        var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores);
-      runner.NotifyScore(Math.round(100 * score));
+      runner.NotifyScore(100 * score);
      }
    }
    RunStep();
@@ -164,7 +164,7 @@ BenchmarkSuite.prototype.NotifyResult = function() {
    var score = this.reference / mean;
    BenchmarkSuite.scores.push(score);
    if (this.runner.NotifyResult) {
-    this.runner.NotifyResult(this.name, Math.round(100 * score));
+    this.runner.NotifyResult(this.name, 100 * score);
    }
  }

@@ -219,3 +219,14 @@ 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);
+  }
+}
Index: benchmarks/run.html
diff --git a/benchmarks/run.html b/benchmarks/run.html
index  
01cadc0d2f538c9fed2c08f5cd1a667f8bbc257a..d521e0b37c52607f57d221002114becf92fa0d5a
  
100644
--- a/benchmarks/run.html
+++ b/benchmarks/run.html
@@ -21,7 +21,7 @@ function ShowProgress(name) {


  function AddResult(name, result) {
-  var text = name + ': ' + result;
+  var text = name + ': ' + formatScore(result);
    var results = document.getElementById("results");
    results.innerHTML += (text + "<br/>");
  }
@@ -36,7 +36,7 @@ function AddError(name, error) {
  function AddScore(score) {
    var status = document.getElementById("status");
    if (success) {
-    status.innerHTML = "Score: " + score;
+    status.innerHTML = "Score: " + formatScore(score);
    }
  }

Index: benchmarks/run.js
diff --git a/benchmarks/run.js b/benchmarks/run.js
index  
da2373b84252447dea31648ca4bd8a9d00a967fc..ecfee90c6b718fe806f4a4451b6875002cbbab59
  
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 + ': ' + result);
+  print(name + ': ' + formatScore(result));
  }


@@ -49,7 +49,8 @@ function PrintError(name, error) {
  function PrintScore(score) {
    if (success) {
      print('----');
-    print('Score (version ' + BenchmarkSuite.version + '): ' + score);
+    print('Score (version ' + BenchmarkSuite.version + '): '
+          + formatScore(score));
    }
  }




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to