Skip to content

Commit

Permalink
add web runner
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed Jul 28, 2013
1 parent bd94b3b commit 4853d7e
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ original:
profile:
jsx --profile --release --run run-with-profile.jsx

web: run-web.jsx
jsx --release --executable web --output $<.js $<

clean:
rm original.js v8bench.jsx.js

Expand Down
63 changes: 63 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>V8 Benchmark Suite for JSX</title>
<link type="text/css" rel="stylesheet" href="v8bench-v7/style.css" />
<script src="run-web.jsx.js"></script>
</head>
<body>
<div>
<div class="title"><h1>V8 Benchmark Suite for JSX - version <span id="version">?</span></h1></div>
<div class="warning" id="obsolete">
Warning! The V8 benchmark has been updated!
Consider
<a href="http://octane-benchmark.googlecode.com/svn/latest/index.html">
running the Octane benchmark</a> instead.
</div>
<table>
<tr>
<td class="contents">
This page contains a suite of pure JavaScript benchmarks that we have
used to tune V8. The final score is computed as the geometric mean of
the individual results to make it independent of the running times of
the individual benchmarks and of a reference system (score
100). Scores are not comparable across benchmark suite versions and
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>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>904 lines</i>).</li>
<li><b>EarleyBoyer</b><br>Classic Scheme benchmarks, translated to JavaScript by Florian Loitsch's Scheme2Js compiler (<i>4684 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>1761 lines</i>).
</li>
<li><b>Splay</b><br>Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (<i>394 lines</i>).</li>
<li><b>NavierStokes</b><br>Solves NavierStokes equations in 2D, heavily manipulating double precision arrays. Based on Oliver Hunt's code (<i>387 lines</i>).</li>
</ul>

<p>
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. For previous revisions and the change log see
the <a href="http://v8.googlecode.com/svn/data/benchmarks/current/revisions.html">revisions</a> page.
</p>

</td><td style="text-align: center">
<div class="run">
<div id="status">Starting...</div>
<div id="results">
</div>
</div>
</td></tr></table>

</div>

</body>
</html>
67 changes: 67 additions & 0 deletions run-web.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

import "js/web.jsx";
import 'console.jsx';

import 'base.jsx';
import 'richards.jsx';
import 'deltablue.jsx';
import 'crypto.jsx';
import 'raytrace.jsx';
//import 'earley-boyer.jsx';
import 'regexp.jsx';
import 'splay.jsx';
import 'navier-stokes.jsx';


class MyBenchmarkRunner extends BenchmarkRunner {

var success = true;

var completed = 0;
var benchmarks = BenchmarkSuite.CountBenchmarks();

override function NotifyStep(name : string) : void {
var status = dom.id("status");
var percentage = (++this.completed / this.benchmarks) * 100;
status.innerHTML = "Running: " + Math.round(percentage) + "% completed.";
}

override function NotifyResult(name : string, result : string) : void {
dom.id("results").innerHTML += name + ': ' + result + "<br />";
}

override function NotifyError(name : string, error : Error) : void {
this.NotifyResult(name, "<strong>" + error.toString() + "</strong>");
this.success = false;
}


override function NotifyScore(score : string) : void {
if (this.success) {
dom.id("status").innerHTML = 'Score: ' + score;
}
}
}

class _Main {
static function run() : void {
console.log("start v8bench version " + BenchmarkSuite.version);

new Richards();
new DeltaBlue();
new Crypto();
new RayTrace();
new RegExpTest();
new Splay();
new NavierStokes();

BenchmarkSuite.RunSuites(new MyBenchmarkRunner());
}

static function main(args : string[]) : void {
dom.id("version").innerHTML = BenchmarkSuite.version;

dom.window.setTimeout(_Main.run, 200);
}
}
// vim: set expandtab:
2 changes: 1 addition & 1 deletion v8bench-v7/run.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script type="text/javascript" src="deltablue.js"></script>
<script type="text/javascript" src="crypto.js"></script>
<script type="text/javascript" src="raytrace.js"></script>
<script type="text/javascript" src="earley-boyer.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>
<script type="text/javascript" src="navier-stokes.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion v8bench.jsx.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
// generatedy by JSX compiler 0.9.57 (2013-07-24 14:56:33 -0700; b9c1243628afba5501738b6e8e775e81eda5ce8e)
// generatedy by JSX compiler 0.9.58 (2013-07-27 00:10:38 -0700; f4826cda73b6b57169d07123e7189e24102380d6)
var JSX = {};
(function (JSX) {
/**
Expand Down

0 comments on commit 4853d7e

Please sign in to comment.