Skip to content
Permalink
Browse files
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:


Canonical link: https://commits.webkit.org/43552@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@52128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
othermaciej committed Dec 15, 2009
1 parent a3e1849 commit 0915105b963cf35a43461bd48c47fe4103b6c823
Showing with 60 additions and 47 deletions.
  1. +20 −0 SunSpider/ChangeLog
  2. +0 −31 SunSpider/hosted/sunspider-record-result.js
  3. +11 −6 SunSpider/make-hosted
  4. +6 −1 SunSpider/resources/TEMPLATE.html
  5. +23 −9 SunSpider/resources/driver-TEMPLATE.html
@@ -1,3 +1,23 @@
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.

This file was deleted.

@@ -61,6 +61,7 @@ foreach my $suite (@suites) {
}
close TESTLIST;

my @testContents = ();
for my $test (@tests) {
my $name = "${test}";

@@ -71,10 +72,11 @@ foreach my $suite (@suites) {
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;
@@ -91,15 +93,18 @@ foreach my $suite (@suites) {
print OUTPUT $output;
close OUTPUT;


my $prefix = "var tests = [ " . join(", ", map { '"' . $_ . '"' } @tests) . " ];\n";
$prefix .= "var categories = [ " . join(", ", map { '"' . $_ . '"' } @categories) . " ];\n";

open PREFIX, ">hosted/${suite}/sunspider-test-prefix.js";
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");
@@ -33,8 +33,13 @@
<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();

@@ -30,44 +30,58 @@
<link rel="stylesheet" href="../sunspider.css">
</head>

<body onload="next()">
<body onload="start()">

<h2><span id="logo">&#x2600;</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;
for (var i = 0; i < output.length; i++) {
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();
}

@@ -90,8 +104,8 @@ <h4>Version: @SUITE@</h4>

</script>

<iframe id="testframe">
</iframe>
<div id="frameparent">
</div>

</body>
</html>

0 comments on commit 0915105

Please sign in to comment.