Author: [EMAIL PROTECTED]
Date: Thu Oct 2 00:43:46 2008
New Revision: 404
Modified:
branches/bleeding_edge/benchmarks/README.txt
branches/bleeding_edge/benchmarks/base.js
branches/bleeding_edge/benchmarks/crypto.js
branches/bleeding_edge/benchmarks/run.html
Log:
Removed the use of Math.random() and new Date() for building
the RNG pool in the crypto benchmark.
Review URL: http://codereview.chromium.org/6071
Modified: branches/bleeding_edge/benchmarks/README.txt
==============================================================================
--- branches/bleeding_edge/benchmarks/README.txt (original)
+++ branches/bleeding_edge/benchmarks/README.txt Thu Oct 2 00:43:46 2008
@@ -9,3 +9,21 @@
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.
Modified: branches/bleeding_edge/benchmarks/base.js
==============================================================================
--- branches/bleeding_edge/benchmarks/base.js (original)
+++ branches/bleeding_edge/benchmarks/base.js Thu Oct 2 00:43:46 2008
@@ -76,6 +76,24 @@
BenchmarkSuite.version = '2 candidate';
+// 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
// each individual benchmark to avoid running for too long in the
// context of browsers. Once done, the final score is reported to the
Modified: branches/bleeding_edge/benchmarks/crypto.js
==============================================================================
--- branches/bleeding_edge/benchmarks/crypto.js (original)
+++ branches/bleeding_edge/benchmarks/crypto.js Thu Oct 2 00:43:46 2008
@@ -1406,7 +1406,9 @@
// 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.
Modified: branches/bleeding_edge/benchmarks/run.html
==============================================================================
--- branches/bleeding_edge/benchmarks/run.html (original)
+++ branches/bleeding_edge/benchmarks/run.html Thu Oct 2 00:43:46 2008
@@ -130,16 +130,21 @@
<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.</p>
+<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>
-<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">
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---