+2013-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Refined power management in SunSpider 1.0.2
+ https://bugs.webkit.org/show_bug.cgi?id=122525
+
+ Reviewed by Gavin Barraclough.
+
+ * hosted/sunspider.css:
+ (#frameparent):
+ (#countdown):
+ * resources/TEMPLATE.html: Provide an explicit countdown element in the
+ parent, instead of hacking it into each child frame.
+
+ * resources/driver-TEMPLATE.html: Be more explicit about how we respond
+ to power management. Just moving setTimeout(0) inside the loop is a
+ little too subtle, and may not work across browsers.
+
+ Also, leave a little extra time after changing the countdown graphic,
+ to give the browser some time to paint.
+
2013-10-02 Geoffrey Garen <ggaren@apple.com>
Improved painting behavior in SunSpider 1.0.2
<title>SunSpider @NAME@</title>
<link rel="stylesheet" href="../sunspider.css">
-<style>
-#countdown {
- font-size: 128px;
- text-align: center;
-}
-</style>
</head>
<body>
-<h3 id="countdown"></h3>
+<h3>@NAME@</h3>
+<div id="console">
+</div>
<script>
-if (window.parent) {
- document.getElementById("countdown").innerHTML =
- window.parent.currentRepeat < 0
- ? "warmup"
- : (window.parent.repeatCount - window.parent.currentRepeat);
-}
-
function record(time) {
- if (window.parent)
+ document.getElementById("console").innerHTML = time + "ms";
+ if (window.parent) {
parent.recordResult(time);
+ }
}
window.onerror = function(e) {
var testIndex = -1;
var currentRepeat = -1;
var repeatCount = 10;
+var warmupMS = 8;
var output = [];
output.length = repeatCount;
output[i] = {};
}
+function warmup()
+{
+ for (var start = new Date; new Date - start < warmupMS; ) {
+ for (var i = 0; i < 100; ++i) {
+ if (Math.atan(Math.acos(Math.asin(Math.random()))) > 4) // Always false.
+ return;
+ }
+ }
+}
+
function start()
{
window.setTimeout(next, 128);
document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>";
var testFrame = document.getElementById("testframe");
if (++testIndex < tests.length) {
- window.setTimeout(next, 0);
+ // Warm up the CPU a little bit, in case power management clocked it down
+ // or put it to sleep. We're trying to strike a balance here: do enough
+ // work so that all browsers see the CPU at an equal clock rate, but
+ // not so much work that we hide performance problems caused by overly
+ // aggressive power management.
+ warmup();
testFrame.contentDocument.open();
testFrame.contentDocument.write(testContents[testIndex]);
testFrame.contentDocument.close();
- } else if (++currentRepeat < repeatCount) {
- window.setTimeout(next, 128);
+ window.setTimeout(next, 0);
+ } else if (++currentRepeat < repeatCount) {
+ document.getElementById("countdown").innerHTML = repeatCount - currentRepeat;
testIndex = -1;
+
+ window.setTimeout(next, 128);
} else {
finish();
}
</script>
-<div id="frameparent">
-</div>
+<h3 id="countdown">warmup</h3>
+<div id="frameparent"></div>
</body>
</html>