aboutsummaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>2008-10-06 08:24:46 +0000
committerkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>2008-10-06 08:24:46 +0000
commit41044eb0969b0d7d5c041a077519a36efa6aff27 (patch)
treee7b0c86db90d4bb76655797769412b9d45f89de3 /benchmarks
parent236ad9617a7359a463144a6ebeb5431a70f769cf (diff)
downloadv8-41044eb0969b0d7d5c041a077519a36efa6aff27.tar.gz
Changed Array.prototype.sort to use quick sort.
Fixed code generation issue where leaving a finally block with break or continue would accumulate elements on the expression stack (issue 86). Made sure that the name accessor on functions returns the expected names for builtin JavaScript functions and C++ callback functions. Added fast case code for extending the property storage array of JavaScript objects. Ported switch statement optimizations introduced in version 0.3.3 to the ARM code generator. Allowed GCC to use strict-aliasing rules when compiling. Improved performance of arguments object allocation by taking care of arguments adaptor frames in the generated code. Updated the V8 benchmark suite to version 2. git-svn-id: http://v8.googlecode.com/svn/trunk@439 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/README.txt18
-rw-r--r--benchmarks/base.js20
-rw-r--r--benchmarks/crypto.js25
-rw-r--r--benchmarks/earley-boyer.js5
-rw-r--r--benchmarks/raytrace.js16
-rw-r--r--benchmarks/richards.js2
-rw-r--r--benchmarks/run.html41
-rw-r--r--benchmarks/run.js2
8 files changed, 109 insertions, 20 deletions
diff --git a/benchmarks/README.txt b/benchmarks/README.txt
index 59a6170d0..70582126b 100644
--- a/benchmarks/README.txt
+++ b/benchmarks/README.txt
@@ -9,3 +9,21 @@ In addition to the benchmarks, the suite consists of the benchmark
framework (base.js), which must be loaded before any of the individual
benchmark files, and two benchmark runners: An HTML version (run.html)
and a standalone JavaScript version (run.js).
+
+
+Changes From Version 1 To Version 2
+===================================
+
+For version 2 the crypto benchmark was fixed. Previously, the
+decryption stage was given plaintext as input, which resulted in an
+error. Now, the decryption stage is given the output of the
+encryption stage as input. The result is checked against the original
+plaintext. For this to give the correct results the crypto objects
+are reset for each iteration of the benchmark. In addition, the size
+of the plain text has been increased a little and the use of
+Math.random() and new Date() to build an RNG pool has been removed.
+
+Other benchmarks were fixed to do elementary verification of the
+results of their calculations. This is to avoid accidentally
+obtaining scores that are the result of an incorrect JavaScript engine
+optimization.
diff --git a/benchmarks/base.js b/benchmarks/base.js
index 55e717d86..f02398deb 100644
--- a/benchmarks/base.js
+++ b/benchmarks/base.js
@@ -73,7 +73,25 @@ BenchmarkSuite.suites = [];
// Scores are not comparable across versions. Bump the version if
// you're making changes that will affect that scores, e.g. if you add
// a new benchmark or change an existing one.
-BenchmarkSuite.version = '1';
+BenchmarkSuite.version = '2';
+
+
+// To make the benchmark results predictable, we replace Math.random
+// with a 100% deterministic alternative.
+Math.random = (function() {
+ var seed = 49734321;
+ return function() {
+ // Robert Jenkins' 32 bit integer hash function.
+ seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
+ seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
+ seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
+ seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;
+ seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;
+ seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff;
+ seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff;
+ return (seed & 0xfffffff) / 0x10000000;
+ };
+})();
// Runs all registered benchmark suites and optionally yields between
diff --git a/benchmarks/crypto.js b/benchmarks/crypto.js
index e284f6759..12b88ef29 100644
--- a/benchmarks/crypto.js
+++ b/benchmarks/crypto.js
@@ -1406,7 +1406,9 @@ function rng_seed_int(x) {
// Mix in the current time (w/milliseconds) into the pool
function rng_seed_time() {
- rng_seed_int(new Date().getTime());
+ // Use pre-computed date to avoid making the benchmark
+ // results dependent on the current date.
+ rng_seed_int(1122926989487);
}
// Initialize the pool with junk if needed.
@@ -1674,16 +1676,23 @@ coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db17
setupEngine(am3, 28);
-var RSA = new RSAKey();
-var TEXT = "The quick brown fox jumped over the extremely lazy frogs!";
-
-RSA.setPublic(nValue, eValue);
-RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue);
+var TEXT = "The quick brown fox jumped over the extremely lazy frog! " +
+ "Now is the time for all good men to come to the party.";
+var encrypted;
function encrypt() {
- return RSA.encrypt(TEXT);
+ var RSA = new RSAKey();
+ RSA.setPublic(nValue, eValue);
+ RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue);
+ encrypted = RSA.encrypt(TEXT);
}
function decrypt() {
- return RSA.decrypt(TEXT);
+ var RSA = new RSAKey();
+ RSA.setPublic(nValue, eValue);
+ RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue);
+ var decrypted = RSA.decrypt(encrypted);
+ if (decrypted != TEXT) {
+ throw new Error("Crypto operation failed");
+ }
}
diff --git a/benchmarks/earley-boyer.js b/benchmarks/earley-boyer.js
index 54a919a7b..9016a137a 100644
--- a/benchmarks/earley-boyer.js
+++ b/benchmarks/earley-boyer.js
@@ -4647,7 +4647,7 @@ var const_earley;
return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() {
return (test(k));
}, function(result) {
- return ((sc_display(result)), (sc_newline()), true);
+ return ((sc_display(result)), (sc_newline()), result == 132);
})));
};
}
@@ -4675,6 +4675,9 @@ SC_ERROR_OUT = SC_DEFAULT_OUT;
function RunBenchmark(name, count, run, warn) {
for (var n = 0; n < count; ++n) {
result = run();
+ if (!warn(result)) {
+ throw new Error("Earley or Boyer did incorrect number of rewrites");
+ }
}
}
diff --git a/benchmarks/raytrace.js b/benchmarks/raytrace.js
index 4561bbcf4..925d0ed35 100644
--- a/benchmarks/raytrace.js
+++ b/benchmarks/raytrace.js
@@ -13,6 +13,8 @@ var RayTrace = new BenchmarkSuite('RayTrace', 932666, [
]);
+var checkNumber;
+
// Create dummy objects if we're not running in a browser.
if (typeof document == 'undefined') {
document = { };
@@ -2669,6 +2671,13 @@ Flog.RayTracer.Color.prototype = {
return result;
},
+ brightness : function() {
+ var r = Math.floor(this.red*255);
+ var g = Math.floor(this.green*255);
+ var b = Math.floor(this.blue*255);
+ return (r * 77 + g * 150 + b * 29) >> 8;
+ },
+
toString : function () {
var r = Math.floor(this.red*255);
var g = Math.floor(this.green*255);
@@ -3152,11 +3161,15 @@ Flog.RayTracer.Engine.prototype = {
this.canvas.fillStyle = color.toString();
this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH);
} else {
+ if (x === y) {
+ checkNumber += color.brightness();
+ }
// print(x * pxW, y * pxH, pxW, pxH);
}
},
renderScene: function(scene, canvas){
+ checkNumber = 0;
/* Get canvas */
if (canvas) {
this.canvas = canvas.getContext("2d");
@@ -3179,6 +3192,9 @@ Flog.RayTracer.Engine.prototype = {
this.setPixel(x, y, color);
}
}
+ if (checkNumber !== 2321) {
+ throw new Error("Scene rendered incorrectly");
+ }
},
getPixelColor: function(ray, scene){
diff --git a/benchmarks/richards.js b/benchmarks/richards.js
index 7df363d98..bb88623cd 100644
--- a/benchmarks/richards.js
+++ b/benchmarks/richards.js
@@ -73,7 +73,7 @@ function runRichards() {
var msg =
"Error during execution: queueCount = " + scheduler.queueCount +
", holdCount = " + scheduler.holdCount + ".";
- print(msg);
+ throw new Error(msg);
}
}
diff --git a/benchmarks/run.html b/benchmarks/run.html
index 307465232..2d49dbc46 100644
--- a/benchmarks/run.html
+++ b/benchmarks/run.html
@@ -18,8 +18,10 @@ hr{
margin:1em 0
}
-h1,h2,h3,h4{margin-bottom:0}
-h1{font-size:160%}
+h1,h2,h3,h4{margin:0; margin-bottom:0}
+h1{font-size: 200%; height: 2em}
+h2{font-size: 140%; height: 2em}
+h3{font-size: 100%; height: 2em}
li{
margin:.3em 0 1em 0;
@@ -41,12 +43,6 @@ div.title {
margin-bottom: 20px;
}
-h1 {
- margin: 0px;
- font-size: 24.5px;
- height: 29.35px;
-}
-
td.contents {
text-align: start;
}
@@ -121,6 +117,35 @@ higher scores means better performance: <em>Bigger is better!</em>
<li><b>EarleyBoyer</b><br/>Classic Scheme benchmarks, translated to JavaScript by Florian Loitsch's Scheme2Js compiler (<i>4682 lines</i>).</li>
</ul>
+<div class="title"><h2>Revisions of the benchmark suite</h2></div>
+
+<p><i>Please note that benchmark results are not comparable unless both
+results are run with the same revision of the benchmark suite. We will be
+making revisions from time to time in order to fix bugs or expand the scope
+of the benchmark suite.</i></p>
+
+<div class="title"><h3>Version 1</h3></div>
+
+<p>Initial release.</p>
+
+<div class="title"><h3>Version 2</h3></div>
+
+<p>For version 2 the crypto benchmark was fixed. Previously, the
+decryption stage was given plaintext as input, which resulted in an
+error. Now, the decryption stage is given the output of the
+encryption stage as input. The result is checked against the original
+plaintext. For this to give the correct results the crypto objects
+are reset for each iteration of the benchmark. In addition, the size
+of the plain text has been increased a little and the use of
+Math.random() and new Date() to build an RNG pool has been
+removed. </p>
+
+<p>Other benchmarks were fixed to do elementary verification of the
+results of their calculations. This is to avoid accidentally
+obtaining scores that are the result of an incorrect JavaScript engine
+optimization.</p>
+
+
</td><td style="text-align: center">
<div class="run">
<div id="status" style="text-align: center; margin-top: 75px; font-size: 120%; font-weight: bold;">Starting...</div>
diff --git a/benchmarks/run.js b/benchmarks/run.js
index 7a1c89584..f73f1af71 100644
--- a/benchmarks/run.js
+++ b/benchmarks/run.js
@@ -41,7 +41,7 @@ function PrintResult(name, result) {
function PrintScore(score) {
print('----');
- print('Score: ' + score);
+ print('Score (version ' + BenchmarkSuite.version + '): ' + score);
}