Reviewed by Sam Weinig.
in-browser SunSpider suffers excessive penalty under power management
https://bugs.webkit.org/show_bug.cgi?id=32505
I have made a few changes to address this:
1) Change how browser-hosted SunSpider loads tests - preload the content and write it in with
document.write to reduce triggering of progress UI.
2) Reduce time between tests to 10ms from 500ms, so that power management doesn't keep the CPU
stepped all the way down the whole time.
3) Run the test cycle an extra time for warmup before the runs that count.
* hosted/sunspider-record-result.js: Removed.
* make-hosted:
* resources/TEMPLATE.html:
* resources/driver-TEMPLATE.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52128
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-12-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ in-browser SunSpider suffers excessive penalty under power management
+ https://bugs.webkit.org/show_bug.cgi?id=32505
+
+ I have made a few changes to address this:
+
+ 1) Change how browser-hosted SunSpider loads tests - preload the content and write it in with
+ document.write to reduce triggering of progress UI.
+ 2) Reduce time between tests to 10ms from 500ms, so that power management doesn't keep the CPU
+ stepped all the way down the whole time.
+ 3) Run the test cycle an extra time for warmup before the runs that count.
+
+ * hosted/sunspider-record-result.js: Removed.
+ * make-hosted:
+ * resources/TEMPLATE.html:
+ * resources/driver-TEMPLATE.html:
+
2009-12-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by Gavin Barraclough.
+++ /dev/null
-/*
- * 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.
- */
-
-function record(time) {
- document.getElementById("console").innerHTML = time + "ms";
- if (window.parent) {
- parent.recordResult(time);
- }
-}
}
close TESTLIST;
+ my @testContents = ();
for my $test (@tests) {
my $name = "${test}";
my $output = $template;
$output =~ s/\@NAME\@/${name}/g;
$output =~ s/\@SCRIPT\@/${script}/g;
-
- open OUTPUT, ">hosted/${suite}/${test}.html";
- print OUTPUT $output;
- close OUTPUT;
+ $output =~ s/\\/\\\\/g;
+ $output =~ s/"/\\"/g;
+ $output =~ s/\n/\\n\\\n/g;
+ $output = $output;
+ push @testContents, $output;
}
my $output = $driverTemplate;
print OUTPUT $output;
close OUTPUT;
-
my $prefix = "var tests = [ " . join(", ", map { '"' . $_ . '"' } @tests) . " ];\n";
$prefix .= "var categories = [ " . join(", ", map { '"' . $_ . '"' } @categories) . " ];\n";
print PREFIX $prefix;
close PREFIX;
-
+ my $contents = "var testContents = [ " . join(", ", map { '"' . $_ . '"' } @testContents) . " ];\n";
+
+ open CONTENTS, ">hosted/${suite}/sunspider-test-contents.js";
+ print CONTENTS $contents;
+ close CONTENTS;
}
system("cp resources/sunspider-analyze-results.js hosted");
<h3>@NAME@</h3>
<div id="console">
</div>
-<script src="../sunspider-record-result.js"></script>
<script>
+function record(time) {
+ document.getElementById("console").innerHTML = time + "ms";
+ if (window.parent) {
+ parent.recordResult(time);
+ }
+}
var _sunSpiderStartDate = new Date();
<link rel="stylesheet" href="../sunspider.css">
</head>
-<body onload="next()">
+<body onload="start()">
<h2><span id="logo">☀</span>SunSpider JavaScript Benchmark <small>(In Progress...)</small></h2>
<h4>Version: @SUITE@</h4>
<script src="sunspider-test-prefix.js"></script>
+<script src="sunspider-test-contents.js"></script>
<script>
var testIndex = -1;
-var currentRepeat = 0;
-var repeatCount = 5;
+var currentRepeat = -1;
+var repeatCount = 10;
var output = [];
output.length = repeatCount;
output[i] = {};
}
-function next()
+function start()
{
window.setTimeout(reallyNext, 500);
}
+function next()
+{
+ window.setTimeout(reallyNext, 10);
+}
+
function reallyNext()
{
+ document.getElementById("frameparent").innerHTML = "";
+ document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>";
+ var testFrame = document.getElementById("testframe");
testIndex++;
if (testIndex < tests.length) {
- document.getElementById("testframe").src = tests[testIndex] + ".html";
+ testFrame.contentDocument.open();
+ testFrame.contentDocument.write(testContents[testIndex]);
+ testFrame.contentDocument.close;
} else if (++currentRepeat < repeatCount) {
testIndex = 0;
- document.getElementById("testframe").src = tests[testIndex] + ".html";
+ testFrame.contentDocument.open();
+ testFrame.contentDocument.write(testContents[testIndex]);
+ testFrame.contentDocument.close;
} else {
finish();
}
function recordResult(time)
{
- output[currentRepeat][tests[testIndex]] = time;
+ if (currentRepeat >= 0) // negative repeats are warmups
+ output[currentRepeat][tests[testIndex]] = time;
next();
}
</script>
-<iframe id="testframe">
-</iframe>
+<div id="frameparent">
+</div>
</body>
</html>