Commit 4866066d authored by sullivan@chromium.org's avatar sullivan@chromium.org

Add a copy of the Kraken Benchmark for performance testing.

This copy was fetched from:
hg.mozilla.org/projects/kraken/

Modifications made:
The python script make-hosted.py was run to update the hosted/ directory, and the unused tests, sunspider, and sunspider-compare-results files were deleted.

BUG=
TEST=

Review URL: http://codereview.chromium.org/10070009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134624 0039d316-1c4b-4281-b951-d872f2087c98
parent 074227a6
This diff is collapsed.
Name: Kraken JavaScript Benchmark
Short Name: kraken
URL: http://krakenbenchmark.mozilla.org
Version: 1.1
License: various
Security Critical: no
Description:
A JavaScript performance benchmark, developed and released by Mozilla.
Local Modifications:
The python script make-hosted.py was run to update the hosted/ directory, and the unused tests, sunspider, and sunspider-compare-results files were deleted.
Kraken 1.1
==========
Fix Bug 599914 - Kraken: audio-beat-detection and audio-fft computes on NaN and undefined.
Kraken 1.0
==========
Initial import.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: A* Search Algorithm</title>
<link rel="stylesheet" href="../kraken.css">
<script src="astar.js"></script>
<script>
function getCanvasContext() {
var canvas = document.getElementById('display');
if (canvas.getContext)
return canvas.getContext('2d');
}
function drawEndpoints(ctx, start, end) {
drawCanvasCell(ctx, start.x, start.y, "rgb(256,0,0)");
drawCanvasCell(ctx, end.x, end.y, "rgb(256,256,0)");
}
function drawSuccessfulPath(nodeList) {
var ctx = getCanvasContext();
for (var i=0; i < nodeList.length; i++) {
ctx.fillStyle = "rgb(256,0,0)";
ctx.fillRect((nodeList[i].x * 5) + 1, (nodeList[i].y * 5) + 1, 3, 3);
}
}
function drawCanvas(graphSet) {
var ctx = getCanvasContext();
for (var i = 0; i < graphSet.length; i++) {
for (var j = 0; j < graphSet.length; j++) {
var node = graphSet[i][j];
if (node.isWall()) {
drawCanvasCell(ctx, node.x, node.y, "rgb(0,0,0)");
} else {
drawCanvasCell(ctx, node.x, node.y, "rgb(50,50,50)");
}
}
}
drawEndpoints(ctx, start, end);
}
function drawCanvasCell(ctx, x, y, style) {
ctx.fillStyle = style;
ctx.fillRect(x * 5, y * 5, 5, 5);
}
function doIt() {
var div = document.getElementById("console");
div.innerHTML += go();
div.innerHTML += "<br>";
drawSuccessfulPath(path);
}
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body onload="drawCanvas(g1);">
<div id="content">
<h2>Kraken JavaScript Benchmark: A* Search Algorithm</h2>
<div id="results">
<p>This benchmark uses the <a href="http://en.wikipedia.org/wiki/A*_search_algorithm">A* search algorithm</a> is used to automatically plot an efficient path between two points,<br> in the presence of obstacles. Adapted from code by <a href="http://www.briangrinstead.com/blog/astar-search-algorithm-in-javascript">Brian Gringstead</a>.</p>
<p>Below, you can watch the algorithm plot a path through the maze.</p>
<canvas id="display" width=500 height=500></canvas>
<p><input onclick="drawCanvas(g1); setTimeout(doIt, 10);" type="button" value="Try It!"></p>
<div id="console"></div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Beat Detection</h2>
<div id="results">
<p>This benchmark performs <a href="http://en.wikipedia.org/wiki/Beat_detection">beat detection</a> on an Audio sample using <a href="http://beatdetektor.svn.sourceforge.net/viewvc/beatdetektor/trunk/core/js/beatdetektor.js?revision=18&view=markup">code</a> from <a href="http://www.cubicproductions.com/index.php?option=com_content&view=article&id=67&Itemid=82">BeatDetektor</a> and <a href="http://github.com/corbanbrook/dsp.js/">DSP.js</a>.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<link type="text/css" href="jquery-ui-1.8.2.custom.css" rel="stylesheet"/>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.2.custom.min.js"></script>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script type="text/javascript" src="darkroom.js"></script>
<style>
#imagedisplay {
width: 70%;
/*background: blue;*/
padding-top: 15px;
padding-bottom: 15px;
float: left;
}
#imagedisplay-inner {
width: 100%;
height: 100%;
-moz-border-radius: 30px;
border: 30px dashed #eeeeee;
}
#controls {
background: rgba(0, 0, 0, .5);
width: 30%;
min-width: 100px;
float: right;
}
.blackbg #controls {
color: white;
}
.graybg #controls {
color: #aaaaaa;
}
#controls h4 {
}
.slidergroup {
margin: 5px;
}
.slidergroup tr {
font-size: 11px;
}
.slider {
margin-left: 15px;
margin-right: 15px;
}
body {
font-family: sans-serif;
}
#log {
font-size: 70%;
margin-left: 10px;
margin-right: 10px;
}
.indrag {
background: rgba(0,128,128,.25);
cursor: default;
}
.options {
margin: 10px;
}
.canzoomin {
cursor: -moz-zoom-in;
}
.canzoomout {
cursor: -moz-zoom-out ! important;
}
.cangrab {
cursor: -moz-grab;
}
.isgrabbing {
cursor: -moz-grabbing ! important;
}
.blackbg {
background: black;
}
.whitebg {
background: white;
}
.graybg {
background: gray;
}
span {
font-size: 11px;
}
</style>
</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Darkroom</h2>
<div id="results">
<p>This benchmark performs a variety of photo manipulations. You can try these manipulations out in the interface below.</p>
<p>&nbsp;</p>
<div id="imagedisplay">
<center><canvas id="canvas"></canvas></center>
</div>
<div id="controls">
<div class="slidergroup">
<h4>Exposure</h4>
<table border="0">
<tr>
<td>Black Point</td>
<td width="100%"><div class="slider" id="blackPoint"></div></td>
</tr>
<tr>
<td>Fill</td>
<td><div class="slider" id="fill"></div></td>
</tr>
<tr>
<td>Brightness</td>
<td><div class="slider" id="brightness"></div></td>
</tr>
<tr>
<td>Contrast</td>
<td><div class="slider" id="contrast"></div></td>
</tr>
<tr>
<td>Saturation</td>
<td><div class="slider" id="saturation"></div></td>
</tr>
<tr>
<td>Temperature</td>
<td><div class="slider" id="temperature"></div></td>
</tr>
</table>
</div>
<div class="slidergroup">
<h4>Tone Control</h4>
<table border="0">
<tr>
<td>Split Point</td>
<td><div class="slider" id="splitPoint"></div></td>
</tr>
<tr><td><b>Shadows</b></td></tr>
<tr>
<td>Hue</td>
<td width="100%"><div class="slider" id="shadowsHue"></div></td>
</tr>
<tr>
<td>Saturation</td>
<td><div class="slider" id="shadowsSaturation"></div></td>
</tr>
<tr><td><b>Highlights</b></td></tr>
<tr>
<td>Hue</td>
<td><div class="slider" id="highlightsHue"></div></td>
</tr>
<tr>
<td>Saturation</td>
<td><div class="slider" id="highlightsSaturation"></div></td>
</tr>
</table>
</div>
<div class="slidergroup">
<h4>Geometry</h4>
<table border="0" width="100%">
<tr><td>Angle (+/- 90.0)</td></tr>
<tr>
<td width="100%"><div class="slider" id="angle"></div></td>
</tr>
<tr><td>Fine Angle (+/- 2.0)</td></tr>
<tr>
<td><div class="slider" id="fineangle"></div></td>
</tr>
</table>
</div>
<div class="options">
<span>Background: <div style="display: inline-block; width: 15px; height: 15px; border: 1px solid white; background: black;" onclick="SetBackground(0);"></div>
<div style="display: inline-block; width: 15px; height: 15px; border: 1px solid white; background: gray;" onclick="SetBackground(1);"></div>
<div style="display: inline-block; width: 15px; height: 15px; border: 1px solid white; background: white;" onclick="SetBackground(2);"></div>
</span><br>
<span style="font-weight: bold;">Drag and drop a new image onto the canvas to load.</span><br>
<button onclick="ZoomReset()">Reset Zoom</button>
<button onclick="DoReset()">Reset All</button>
<button onclick="DoRedisplay()">Repaint</button><br><br>
<input type="checkbox" id="correct_before" onchange="CheckboxToggled()">Color correct before scaling for display<br><br>
</div>
<div id="log"></div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Desaturate</h2>
<div id="results">
<p>This benchmark <a href="http://en.wikipedia.org/wiki/Colorfulness">desaturates</a> a photo using code from <a href="http://www.pixastic.com/">Pixastic</a>.</p>
<p><small>Photo courtesy <a href="http://www.flickr.com/photos/katclay/4296523922/in/photostream/">Kat Clay</a> from Flickr</small>.</p>
<img id="image" src="squid.png" width="400" height="267">
<canvas id="canvas" width="400" height="267"></canvas>
<script>
/*
* Pixastic Lib - Desaturation filter - v0.1.1
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
* License: [http://www.pixastic.com/lib/license.txt] (MPL 1.1)
*/
var Pixastic = {};
Pixastic.Actions = {};
Pixastic.Actions.desaturate = {
process : function(params) {
var useAverage = !!(params.options.average && params.options.average != "false");
var data = params.data;
var rect = params.options.rect;
var w = rect.width;
var h = rect.height;
var p = w*h;
var pix = p*4, pix1, pix2;
if (useAverage) {
while (p--)
data[pix-=4] = data[pix1=pix+1] = data[pix2=pix+2] = (data[pix]+data[pix1]+data[pix2])/3
} else {
while (p--)
data[pix-=4] = data[pix1=pix+1] = data[pix2=pix+2] = (data[pix]*0.3 + data[pix1]*0.59 + data[pix2]*0.11);
}
return true;
}
}
function desaturateTest() {
var results = document.getElementById('blur-result');
results.innerHTML = "Running test...";
window.setTimeout(function() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var img = document.getElementById('image')
ctx.drawImage(img, 0, 0, img.width, img.height);
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
var width = imgData.width, height = imgData.height;
var data = imgData.data;
var len = data.length;
var startTime = (new Date()).getTime();
var params = {
options: {
rect: { width: width, height: height}
},
data: imgData.data
}
Pixastic.Actions.desaturate.process(params);
var finishTime = Date.now() - startTime;
for (var i = 0; i < data.length; i++) {
imgData.data[i] = data[i];
}
//imgData.data = data;
ctx.putImageData(imgData, 0, 0);
results.innerHTML = "Finished: " + finishTime + "ms";
}, 10);
}
</script>
<p><input type="button" value="Desaturate Test" onclick="desaturateTest();">&nbsp;<span id="blur-result"></span></p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Discrete Fourier Transform</h2>
<div id="results">
<p>This benchmark performs a <a href="http://en.wikipedia.org/wiki/Discrete_Fourier_transform">Discrete Fourier Transform</a> on an Audio sample using code from <a href="http://github.com/corbanbrook/dsp.js/">DSP.js</a>.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Fast Fourier Transform</h2>
<div id="results">
<p>This benchmark performs a <a href="http://en.wikipedia.org/wiki/Fast_Fourier_transform">Fast Fourier Transform</a> on an Audio sample using code from <a href="http://github.com/corbanbrook/dsp.js/">DSP.js</a>.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Gaussian Blur</h2>
<div id="results">
<p>This benchmark performs a <a href="http://en.wikipedia.org/wiki/Gaussian_blur">Gaussian blur</a> on a photo.</p>
<p><small>Photo courtesy <a href="http://www.flickr.com/photos/katclay/4296523922/in/photostream/">Kat Clay</a> from Flickr</small>.</p>
<img id="image" src="squid.png" width="400" height="267">
<canvas id="canvas" width="400" height="267"></canvas>
<script>
var sigma = 10; // radius
var kernel, kernelSize, kernelSum;
buildKernel();
try {
// Opera createImageData fix
if (!("createImageData" in CanvasRenderingContext2D.prototype)) {
CanvasRenderingContext2D.prototype.createImageData = function(sw,sh) { return this.getImageData(0,0,sw,sh); }
}
} catch(e) {}
function buildKernel() {
var ss = sigma * sigma;
var factor = 2 * Math.PI * ss;
kernel = [];
kernel.push([]);
var i = 0, j;
do {
var g = Math.exp(-(i * i) / (2 * ss)) / factor;
if (g < 1e-3) break;
kernel[0].push(g);
++i;
} while (i < 7);
kernelSize = i;
for (j = 1; j < kernelSize; ++j) {
kernel.push([]);
for (i = 0; i < kernelSize; ++i) {
var g = Math.exp(-(i * i + j * j) / (2 * ss)) / factor;
kernel[j].push(g);
}
}
kernelSum = 0;
for (j = 1 - kernelSize; j < kernelSize; ++j) {
for (i = 1 - kernelSize; i < kernelSize; ++i) {
kernelSum += kernel[Math.abs(j)][Math.abs(i)];
}
}
}
function blurTest() {
var results = document.getElementById('blur-result');
results.innerHTML = "Running test...";
window.setTimeout(function() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var img = document.getElementById('image')
ctx.drawImage(img, 0, 0, img.width, img.height);
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
var width = imgData.width, height = imgData.height;
var data = imgData.data;
var len = data.length;
var startTime = (new Date()).getTime();
for (var y = 0; y < height; ++y) {
for (var x = 0; x < width; ++x) {
var r = 0, g = 0, b = 0, a = 0;
for (j = 1 - kernelSize; j < kernelSize; ++j) {
if (y + j < 0 || y + j >= height) continue;
for (i = 1 - kernelSize; i < kernelSize; ++i) {
if (x + i < 0 || x + i >= width) continue;
r += data[4 * ((y + j) * width + (x + i)) + 0] * kernel[Math.abs(j)][Math.abs(i)];
g += data[4 * ((y + j) * width + (x + i)) + 1] * kernel[Math.abs(j)][Math.abs(i)];
b += data[4 * ((y + j) * width + (x + i)) + 2] * kernel[Math.abs(j)][Math.abs(i)];
a += data[4 * ((y + j) * width + (x + i)) + 3] * kernel[Math.abs(j)][Math.abs(i)];
}
}
data[4 * (y * width + x) + 0] = r / kernelSum;
data[4 * (y * width + x) + 1] = g / kernelSum;
data[4 * (y * width + x) + 2] = b / kernelSum;
data[4 * (y * width + x) + 3] = a / kernelSum;
}
}
var finishTime = Date.now() - startTime;
for (var i = 0; i < data.length; i++) {
imgData.data[i] = data[i];
}
//imgData.data = data;
ctx.putImageData(imgData, 0, 0);
results.innerHTML = "Finished: " + finishTime + "ms";
}, 10);
}
</script>
<p><input type="button" value="Blur Test" onclick="blurTest();">&nbsp;<span id="blur-result"></span></p>
</div>
</div>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: Gaussian Blur</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: Oscillator</h2>
<div id="results">
<p>This benchmark generates a soundwave using code from <a href="http://github.com/corbanbrook/dsp.js/">DSP.js</a>.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: JSON Parse - Financial</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: JSON Parse - Financial</h2>
<div id="results">
<p>This benchmark parses <a href="http://www.json.org">JSON</a> records.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark: JSON Stringify - Tinderbox</title>
<link rel="stylesheet" href="../kraken.css">
<script>
</script>
<style> #display { border: 5px solid rgb(0,0,50);}</style>
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark: JSON Stringify - Tinderbox</h2>
<div id="results">
<p>This benchmark serializes <a href="http://tests.themasta.com/tinderboxpushlog/?tree=Firefox">Tinderbox</a> build data to <a href="http://www.json.org">JSON</a>.</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark (version 1.1)</title>
<link rel="stylesheet" href="kraken.css">
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark (version 1.1)</h2>
<div id="results">
<p><a href="kraken-1.1/driver.html">Begin</a> <small>(This will start a rather big download)</small></p>
<p></p>
</div>
</div>
</body>
</html>
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark (kraken-1.1 test suite - In Progress...)</title>
<link rel="stylesheet" href="../kraken.css">
</head>
<body onload="start()">
<div id="content">
<h2>Kraken JavaScript Benchmark <small>(In Progress...)</small></h2>
<div id="results">
<h3>Content Version: kraken-1.1</h3>
<script src="test-prefix.js"></script>
<script src="test-contents.js"></script>
<script>
var testIndex = -1;
var currentRepeat = -1;
var repeatCount = 10;
var currentSquare = 1;
var output = [];
output.length = repeatCount;
for (var i = 0; i < output.length; i++) {
output[i] = {};
}
function initSquares() {
var squaresDiv = document.getElementById("squares");
var id = 0;
for (var i = 0; i < repeatCount; i++) {
for (var j = 0; j <= tests.length; j++) {
id++;
squaresDiv.innerHTML += "<span class='incomplete-square' id='square-" + id + "'>\u25A0</span>";
}
squaresDiv.innerHTML += "<br>";
}
}
function completeSquare() {
var square = document.getElementById("square-" + currentSquare);
if (square) {
square.className = "complete-square";
currentSquare++;
}
}
function start()
{
initSquares();
window.setTimeout(reallyNext, 500);
}
function next()
{
window.setTimeout(reallyNext, 10);
}
function reallyNext()
{
completeSquare();
document.getElementById("frameparent").innerHTML = "";
document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>";
var testFrame = document.getElementById("testframe");
testIndex++;
if (testIndex < tests.length) {
testFrame.contentDocument.open();
testFrame.contentDocument.write(testContents[testIndex]);
testFrame.contentDocument.close;
} else if (++currentRepeat < repeatCount) {
testIndex = 0;
testFrame.contentDocument.open();
testFrame.contentDocument.write(testContents[testIndex]);
testFrame.contentDocument.close;
} else {
finish();
}
}
function recordResult(time)
{
if (currentRepeat >= 0) // negative repeats are warmups
output[currentRepeat][tests[testIndex]] = time;
next();
}
function finish()
{
var outputString = "{";
outputString += '"v": "kraken-1.1", ';
for (var test in output[0]) {
outputString += '"' + test + '":[';
for (var i = 0; i < output.length; i++) {
outputString += output[i][test] + ",";
}
outputString = outputString.substring(0, outputString.length - 1);
outputString += "],";
}
outputString = outputString.substring(0, outputString.length - 1);
outputString += "}";
location = "results.html?" + encodeURI(outputString);
}
</script>
<div id="frameparent">
</div>
<div id="squares"></div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark Results (kraken-1.1 test suite)</title>
<link rel="stylesheet" href="../kraken.css">
</head>
<body>
<div id="content">
<h2>Kraken JavaScript Benchmark Results</h2>
<div id="results">
<h3>Content Version: kraken-1.1</h3>
<p><a href="driver.html">Run Again</a></p>
<p><input style="width: 100%;" id="selfUrl" type="text" readonly="readonly"><br>
<small>(You can bookmark this results URL for later comparison.)</small></p>
<form onsubmit="event.preventDefault(); compare(other.value);">To compare to another run, paste a saved result URL in the text field below and press enter:<br>
<input style="width: 100%;" name="other" type="text"><br>
</form>
<pre id="console"></pre>
</div>
</div>
<script src="../json2.js"></script>
<script>
//XXX generate this automatically
var explanations = {
"astar":"../explanations/astar.html",
"gaussian-blur":"../explanations/gaussian-blur.html",
"darkroom":"../explanations/darkroom.html",
"desaturate":"../explanations/desaturate.html",
"beat-detection":"../explanations/beat-detection.html",
"dft":"../explanations/dft.html",
"fft":"../explanations/fft.html",
"oscillator":"../explanations/oscillator.html",
"parse-financial":"../explanations/parse-financial.html",
"stringify-tinderbox":"../explanations/stringify-tinderbox.html"
}
var selfUrlInput = document.getElementById("selfUrl");
selfUrlInput.value = location;
var outputJSON = JSON.parse(decodeURI(location.search.substring(1)));
var version = outputJSON["v"];
delete outputJSON["v"];
var output = pivot(outputJSON);
function pivot(input) {
var output = [];
for (var test in input) {
for (var i = 0; i < input[test].length; i++) {
if (!output[i])
output[i] = {};
output[i][test] = input[test][i];
}
}
return output;
}
function print(str) {
var console = document.getElementById("console");
console.innerHTML += str;
console.innerHTML += "<br>";
}
</script>
<script src="test-prefix.js"></script>
<script src="../analyze-results.js"></script>
<script src="../compare-results.js"></script>
<script>
var output2 = output;
var version2 = version;
function compare(other)
{
document.getElementById("console").innerHTML = "";
var output1JSON = JSON.parse(decodeURI(other.split("?")[1]));
var version1 = output1JSON["v"];
delete output1JSON["v"];
if (version1 != version2) {
print("ERROR: cannot compare version " + version1 + ' with version ' + version2);
} else {
var output1 = pivot(output1JSON);
sunspiderCompareResults(output1, output2);
}
}
</script>
</body>
</html>
var tests = [ "ai-astar", "audio-beat-detection", "audio-dft", "audio-fft", "audio-oscillator", "imaging-gaussian-blur", "imaging-darkroom", "imaging-desaturate", "json-parse-financial", "json-stringify-tinderbox", "stanford-crypto-aes", "stanford-crypto-ccm", "stanford-crypto-pbkdf2", "stanford-crypto-sha256-iterative" ];
var categories = [ "ai", "audio", "imaging", "json", "stanford" ];
body {
font-family: Helvetica, Arial, sans-serif;
margin: 20px;
background-color: #ffffff;
color: #1B0636
}
h2 {
background-color: #fff;
padding: 30px 20px 20px 20px;
border-bottom: 3px solid white;
color: black;
zoom: 1.0 /* I CAN HAS LAYOUT? (ie hack) */
}
#content {
width: 1000px;
margin-left: auto;
margin-right: auto;
}
#results {
padding: 0 20px 20px 20px;
}
:link { color: #1363A1 }
:visited { color: #1363A1 }
#testframe { float: left;
margin-top: 20px;
width: 500px;
height: 200px;
background-color: white;
border: 1px solid #1B0636;}
#squares {
float: left;
margin-left: 10px;
margin-top: 20px;
}
span.incomplete-square {
color: #cccccc;
}
span.complete-square {
color: #e7c0c0;
}
small.fine {
color: #cccccc;
}
\ No newline at end of file
#!/usr/bin/python
# Copyright (C) 2007 Apple Inc. All rights reserved.
# Copyright (C) 2010 Mozilla Foundation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import with_statement
import os
import shutil
suites = ["kraken-1.1", "kraken-1.0", "sunspider-0.9.1"]
def readTemplate(path):
with open(path, 'r') as f:
return f.read()
template = readTemplate("resources/TEMPLATE.html")
driverTemplate = readTemplate("resources/driver-TEMPLATE.html")
resultsTemplate = readTemplate("resources/results-TEMPLATE.html")
def testListForSuite(suite):
tests = []
with open("./tests/%s/LIST" % suite, "r") as f:
for line in f.readlines():
tests.append(line.strip())
return tests
def categoriesFromTests(tests):
categories = set()
for test in tests:
categories.add(test[:test.find("-")])
categories = list(categories)
categories.sort()
return categories
def escapeTestContent(test,suite):
with open("tests/" + suite + "/" + test + ".js") as f:
script = f.read()
output = template
output = output.replace("@NAME@", test)
output = output.replace("@SCRIPT@", script)
dataPath = "tests/" + suite + "/" + test + "-data.js"
if (os.path.exists(dataPath)):
with open(dataPath) as f:
datascript = f.read()
output = output.replace("@DATASCRIPT@", datascript)
datascript = None
output = output.replace("\\", "\\\\")
output = output.replace('"', '\\"')
output = output.replace("\n", "\\n\\\n")
return output
def testContentsFromTests(suite, tests):
testContents = [];
for test in tests:
testContents.append(escapeTestContent(test, suite))
return testContents
def writeTemplate(suite, template, fileName):
output = template.replace("@SUITE@", suite)
with open("hosted/" + suite + "/" + fileName, "w") as f:
f.write(output)
for suite in suites:
suiteDir = os.path.join("hosted", suite)
if not os.path.exists(suiteDir):
os.mkdir(suiteDir)
tests = testListForSuite(suite)
categories = categoriesFromTests(tests)
testContents = testContentsFromTests(suite, tests)
writeTemplate(suite, driverTemplate, "driver.html")
writeTemplate(suite, resultsTemplate, "results.html")
prefix = "var tests = [ " + ", ".join(['"%s"' % s for s in tests]) + " ];\n"
prefix += "var categories = [ " + ", ".join(['"%s"' % s for s in categories]) + " ];\n"
with open("hosted/" + suite + "/test-prefix.js", "w") as f:
f.write(prefix)
contents = "var testContents = [ " + ", ".join(['"%s"' % s for s in testContents]) + " ];\n"
with open("hosted/" + suite + "/test-contents.js", "w") as f:
f.write(contents)
shutil.copyfile("resources/analyze-results.js", "hosted/analyze-results.js")
shutil.copyfile("resources/compare-results.js", "hosted/compare-results.js")
print("You're awesome!")
<!DOCTYPE html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>SunSpider @NAME@</title>
<link rel="stylesheet" href="../kraken.css">
</head>
<body>
<h3>@NAME@</h3>
<div id="console">
</div>
<script>
function record(time) {
document.getElementById("console").innerHTML = time + "ms";
if (window.parent) {
parent.recordResult(time);
}
}
@DATASCRIPT@
var _sunSpiderStartDate = new Date();
@SCRIPT@
var _sunSpiderInterval = new Date() - _sunSpiderStartDate;
record(_sunSpiderInterval);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf8>
<!--
Copyright (C) 2007 Apple Inc. All rights reserved.
Copyright (C) 2010 Mozilla Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<title>Kraken JavaScript Benchmark (@SUITE@ test suite - In Progress...)</title>
<link rel="stylesheet" href="../kraken.css">
</head>
<body onload="start()">
<div id="content">
<h2>Kraken JavaScript Benchmark <small>(In Progress...)</small></h2>
<div id="results">
<h3>Content Version: @SUITE@</h3>
<script src="test-prefix.js"></script>
<script src="test-contents.js"></script>
<script>
var testIndex = -1;
var currentRepeat = -1;
var repeatCount = 10;
var currentSquare = 1;
var output = [];
output.length = repeatCount;
for (var i = 0; i < output.length; i++) {
output[i] = {};
}
function initSquares() {
var squaresDiv = document.getElementById("squares");
var id = 0;
for (var i = 0; i < repeatCount; i++) {
for (var j = 0; j <= tests.length; j++) {
id++;
squaresDiv.innerHTML += "<span class='incomplete-square' id='square-" + id + "'>\u25A0</span>";
}
squaresDiv.innerHTML += "<br>";
}
}
function completeSquare() {
var square = document.getElementById("square-" + currentSquare);
if (square) {
square.className = "complete-square";
currentSquare++;
}
}
function start()
{
initSquares();
window.setTimeout(reallyNext, 500);
}
function next()
{
window.setTimeout(reallyNext, 10);
}
function reallyNext()
{
completeSquare();
document.getElementById("frameparent").innerHTML = "";
document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>";
var testFrame = document.getElementById("testframe");
testIndex++;
if (testIndex < tests.length) {
testFrame.contentDocument.open();
testFrame.contentDocument.write(testContents[testIndex]);
testFrame.contentDocument.close;
} else if (++currentRepeat < repeatCount) {
testIndex = 0;
testFrame.contentDocument.open();
testFrame.contentDocument.write(testContents[testIndex]);
testFrame.contentDocument.close;
} else {
finish();
}
}
function recordResult(time)
{
if (currentRepeat >= 0) // negative repeats are warmups
output[currentRepeat][tests[testIndex]] = time;
next();
}
function finish()
{
var outputString = "{";
outputString += '"v": "@SUITE@", ';
for (var test in output[0]) {
outputString += '"' + test + '":[';
for (var i = 0; i < output.length; i++) {
outputString += output[i][test] + ",";
}
outputString = outputString.substring(0, outputString.length - 1);
outputString += "],";
}
outputString = outputString.substring(0, outputString.length - 1);
outputString += "}";
location = "results.html?" + encodeURI(outputString);
}
</script>
<div id="frameparent">
</div>
<div id="squares"></div>
</div>
</div>
</body>
</html>
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
sunspiderCompareResults(output1, output2);
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var results = new Array();
var time = 0;
var times = [];
times.length = tests.length;
for (var krakenCounter = 0; krakenCounter < tests.length; krakenCounter++) {
var testBase = "tests/" + suiteName + "/" + tests[krakenCounter];
var testName = testBase + ".js";
var testData = testBase + "-data.js";
// load test data
load(testData);
var startTime = new Date;
load(testName);
times[krakenCounter] = new Date() - startTime;
gc();
}
function recordResults(tests, times)
{
var output = "{\n";
for (j = 0; j < tests.length; j++) {
output += ' "' + tests[j] + '": ' + times[j] + ',\n';
}
output = output.substring(0, output.length - 2) + "\n";
output += "}";
print(output);
}
recordResults(tests, times);
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