Commit 87827fd2 authored by ggaren@apple.com's avatar ggaren@apple.com

WebKit should have performance tests for book chapter reflow

https://bugs.webkit.org/show_bug.cgi?id=101271

Reviewed by Dan Bernstein.

I grabbed a book chapter from the Project Gutenberg front page:

* Layout/chapter-reflow-once.html: Added.
* Layout/chapter-reflow-thrice.html: Added.
* Layout/chapter-reflow-twice.html: Added.
* Layout/chapter-reflow.html: Added.

I also created a torture-test random text generator:

* Layout/chapter-reflow-once-random.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ee0d00cb
2012-11-05 Geoffrey Garen <ggaren@apple.com>
WebKit should have performance tests for book chapter reflow
https://bugs.webkit.org/show_bug.cgi?id=101271
Reviewed by Dan Bernstein.
I grabbed a book chapter from the Project Gutenberg front page:
* Layout/chapter-reflow-once.html: Added.
* Layout/chapter-reflow-thrice.html: Added.
* Layout/chapter-reflow-twice.html: Added.
* Layout/chapter-reflow.html: Added.
I also created a torture-test random text generator:
* Layout/chapter-reflow-once-random.html: Added.
2012-10-29 Zoltan Horvath <zoltan@webkit.org>
Turn PageLoad tests into simple performancetests, commit #7 (last)
......
<!DOCTYPE html>
<html>
<head>
<title>Chapter reflow performance test: random text</title>
<script src="../resources/runner.js"></script>
</head>
<body>
<pre id="log"></pre>
<div id="target" style="width: 300px; display: none;">
</div>
<script>
var RandomTextGenerator = function() {
this.letters = [
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode),
String.fromCharCode(RandomTextGenerator.firstCharCode)
]
}
RandomTextGenerator.firstCharCode = 65; // 'A'
RandomTextGenerator.lastCharCode = 123; // 'z'
RandomTextGenerator.prototype.advance = function(index) {
var charCode = this.letters[index].charCodeAt(0);
var newCharCode = charCode + 1;
if (newCharCode > RandomTextGenerator.lastCharCode)
newCharCode = RandomTextGenerator.firstCharCode;
this.letters[index] = String.fromCharCode(newCharCode);
return charCode;
}
RandomTextGenerator.prototype.generate = function() {
var result = this.letters.join("");
var index = 0;
while (1) {
var charCode = this.advance(index);
if (charCode != RandomTextGenerator.lastCharCode)
break;
++index;
}
return result;
}
var target = document.getElementById("target");
var style = target.style;
var randomTextGenerator = new RandomTextGenerator;
function test() {
var target = document.getElementById("target");
var style = target.style;
var innerHTML = "<p>";
for (var i = 0; i < 5000; ++i)
innerHTML += randomTextGenerator.generate() + " ";
innerHTML += "</p>";
target.innerHTML = innerHTML;
style.display = "block";
style.width = "280px";
target.offsetLeft;
style.display = "none";
}
PerfTestRunner.measureRunsPerSecond({ run: test });
</script>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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