Author: [email protected]
Date: Tue Jan 13 01:27:47 2009
New Revision: 1061

Modified:
    branches/bleeding_edge/benchmarks/base.js
    branches/bleeding_edge/benchmarks/run.html
    branches/bleeding_edge/benchmarks/run.js

Log:
Fix benchmarks to not format scores that are really errors.

Uploading for Kasper.
Review URL: http://codereview.chromium.org/17641

Modified: branches/bleeding_edge/benchmarks/base.js
==============================================================================
--- branches/bleeding_edge/benchmarks/base.js   (original)
+++ branches/bleeding_edge/benchmarks/base.js   Tue Jan 13 01:27:47 2009
@@ -120,7 +120,8 @@
      }
      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 @@
  }


+// 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 @@
    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);
    }
  }

@@ -218,15 +230,4 @@
      return null;
    }
    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);
-  }
  }

Modified: branches/bleeding_edge/benchmarks/run.html
==============================================================================
--- branches/bleeding_edge/benchmarks/run.html  (original)
+++ branches/bleeding_edge/benchmarks/run.html  Tue Jan 13 01:27:47 2009
@@ -21,7 +21,7 @@


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


Modified: branches/bleeding_edge/benchmarks/run.js
==============================================================================
--- branches/bleeding_edge/benchmarks/run.js    (original)
+++ branches/bleeding_edge/benchmarks/run.js    Tue Jan 13 01:27:47 2009
@@ -36,7 +36,7 @@
  var success = true;

  function PrintResult(name, result) {
-  print(name + ': ' + formatScore(result));
+  print(name + ': ' + result);
  }


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


--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to