Commit 1a54dd01 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Add new Splay benchmark to the V8 benchmark suite and remove

the unused parts (most) of the Prototype library from raytrace.js.
Review URL: http://codereview.chromium.org/115227

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1910 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent bde19c73
......@@ -40,3 +40,15 @@ pages where it occurs and the number of times it is executed while
loading each page. Finally the literal letters in the data are
encoded using ROT13 in a way that does not affect how the regexps
match their input.
Changes from Version 3 to Version 4
===================================
The Splay benchmark is a newcomer in version 4. It manipulates a
splay tree by adding and removing data nodes, thus exercising the
memory management subsystem of the JavaScript engine.
Furthermore, all the unused parts of the Prototype library were
removed from the RayTrace benchmark. This does not affect the running
of the benchmark.
......@@ -31,10 +31,15 @@
// A benchmark has a name (string) and a function that will be run to
// do the performance measurement.
function Benchmark(name, run) {
// do the performance measurement. The optional setup and tearDown
// arguments are functions that will be invoked before and after
// running the benchmark, but the running time of these functions will
// not be accounted for in the benchmark score.
function Benchmark(name, run, setup, tearDown) {
this.name = name;
this.run = run;
this.Setup = setup ? setup : function() { };
this.TearDown = tearDown ? tearDown : function() { };
}
......@@ -73,7 +78,7 @@ 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 = '3';
BenchmarkSuite.version = '4';
// To make the benchmark results predictable, we replace Math.random
......@@ -114,7 +119,7 @@ BenchmarkSuite.RunSuites = function(runner) {
continuation = suite.RunStep(runner);
}
if (continuation && typeof window != 'undefined' && window.setTimeout) {
window.setTimeout(RunStep, 100);
window.setTimeout(RunStep, 25);
return;
}
}
......@@ -194,7 +199,7 @@ BenchmarkSuite.prototype.NotifyError = function(error) {
// Runs a single benchmark for at least a second and computes the
// average time it takes to run a single iteration.
BenchmarkSuite.prototype.RunSingle = function(benchmark) {
BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) {
var elapsed = 0;
var start = new Date();
for (var n = 0; elapsed < 1000; n++) {
......@@ -216,18 +221,45 @@ BenchmarkSuite.prototype.RunStep = function(runner) {
var length = this.benchmarks.length;
var index = 0;
var suite = this;
function RunNext() {
// Run the setup, the actual benchmark, and the tear down in three
// separate steps to allow the framework to yield between any of the
// steps.
function RunNextSetup() {
if (index < length) {
try {
suite.RunSingle(suite.benchmarks[index++]);
suite.benchmarks[index].Setup();
} catch (e) {
suite.NotifyError(e);
return null;
}
return RunNext;
return RunNextBenchmark;
}
suite.NotifyResult();
return null;
}
return RunNext();
function RunNextBenchmark() {
try {
suite.RunSingleBenchmark(suite.benchmarks[index]);
} catch (e) {
suite.NotifyError(e);
return null;
}
return RunNextTearDown;
}
function RunNextTearDown() {
try {
suite.benchmarks[index++].TearDown();
} catch (e) {
suite.NotifyError(e);
return null;
}
return RunNextSetup;
}
// Start out running the setup.
return RunNextSetup();
}
......@@ -16,10 +16,10 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// This implementation of the DeltaBlue benchmark is derived
// from the Smalltalk implementation by John Maloney and Mario
// Wolczko. Some parts have been translated directly, whereas
// others have been modified more aggresively to make it feel
// This implementation of the DeltaBlue benchmark is derived
// from the Smalltalk implementation by John Maloney and Mario
// Wolczko. Some parts have been translated directly, whereas
// others have been modified more aggresively to make it feel
// more like a JavaScript program.
......
......@@ -4682,4 +4682,3 @@ function RunBenchmark(name, count, run, warn) {
}
var BgL_runzd2benchmarkzd2 = RunBenchmark;
This diff is collapsed.
......@@ -20,6 +20,20 @@ the benchmark suite.
</p>
<div class="subtitle"><h3>Version 4 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v4/run.html">link</a>)</h3></div>
<p>The <i>Splay</i> benchmark is a newcomer in version 4. It
manipulates a splay tree by adding and removing data nodes, thus
exercising the memory management subsystem of the JavaScript engine.
</p>
<p>
Furthermore, all the unused parts of the Prototype library were
removed from the RayTrace benchmark. This does not affect the running
of the benchmark.
</p>
<div class="subtitle"><h3>Version 3 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v3/run.html">link</a>)</h3></div>
<p>Version 3 adds a new benchmark, <i>RegExp</i>. The RegExp
......@@ -32,9 +46,10 @@ encoded using ROT13 in a way that does not affect how the regexps
match their input.
</p>
<div class="subtitle"><h3>Version 2 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v2/run.html">link</a>)</h3></div>
<p>For version 2 the crypto benchmark was fixed. Previously, the
<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
......@@ -49,6 +64,7 @@ results of their calculations. This is to avoid accidentally
obtaining scores that are the result of an incorrect JavaScript engine
optimization.</p>
<div class="subtitle"><h3>Version 1 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v1/run.html">link</a>)</h3></div>
<p>Initial release.</p>
......
......@@ -30,7 +30,7 @@
// benchmark from:
//
// http://www.cl.cam.ac.uk/~mr10/Bench.html
//
//
// The benchmark was originally implemented in BCPL by
// Martin Richards.
......
......@@ -8,6 +8,7 @@
<script type="text/javascript" src="raytrace.js"></script>
<script type="text/javascript" src="earley-boyer.js"></script>
<script type="text/javascript" src="regexp.js"></script>
<script type="text/javascript" src="splay.js"></script>
<link type="text/css" rel="stylesheet" href="style.css"></link>
<script type="text/javascript">
var completed = 0;
......@@ -72,12 +73,13 @@ higher scores means better performance: <em>Bigger is better!</em>
<ul>
<li><b>Richards</b><br/>OS kernel simulation benchmark, originally written in BCPL by Martin Richards (<i>539 lines</i>).</li>
<li><b>DeltaBlue</b><br/>One-way constraint solver, originally written in Smalltalk by John Maloney and Mario Wolczko (<i>880 lines</i>).</li>
<li><b>Crypto</b><br/>Encryption and decryption benchmark based on code by Tom Wu (<i>1689 lines</i>).</li>
<li><b>RayTrace</b><br/>Ray tracer benchmark based on code by <a href="http://flog.co.nz/">Adam Burmister</a> (<i>3418 lines</i>).</li>
<li><b>EarleyBoyer</b><br/>Classic Scheme benchmarks, translated to JavaScript by Florian Loitsch's Scheme2Js compiler (<i>4682 lines</i>).</li>
<li><b>Crypto</b><br/>Encryption and decryption benchmark based on code by Tom Wu (<i>1698 lines</i>).</li>
<li><b>RayTrace</b><br/>Ray tracer benchmark based on code by <a href="http://flog.co.nz/">Adam Burmister</a> (<i>935 lines</i>).</li>
<li><b>EarleyBoyer</b><br/>Classic Scheme benchmarks, translated to JavaScript by Florian Loitsch's Scheme2Js compiler (<i>4685 lines</i>).</li>
<li><b>RegExp</b><br/>Regular expression benchmark generated by extracting regular expression operations from 50 of the most popular web pages
(<i>4758 lines</i>).
(<i>1614 lines</i>).
</li>
<li><b>Splay</b><br/>Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (<i>378 lines</i>).</li>
</ul>
<p>
......@@ -90,7 +92,7 @@ the <a href="http://v8.googlecode.com/svn/data/benchmarks/current/revisions.html
</td><td style="text-align: center">
<div class="run">
<div id="status" style="text-align: center; margin-top: 60px; font-size: 120%; font-weight: bold;">Starting...</div>
<div id="status" style="text-align: center; margin-top: 50px; font-size: 120%; font-weight: bold;">Starting...</div>
<div style="text-align: left; margin: 30px 0 0 90px;" id="results">
<div>
</div>
......
......@@ -33,6 +33,7 @@ load('crypto.js');
load('raytrace.js');
load('earley-boyer.js');
load('regexp.js');
load('splay.js');
var success = true;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment