mirror of
https://github.com/servo/servo.git
synced 2025-09-10 15:08:21 +01:00
Vendors the [blink perf tests](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/perf_tests/). These perf tests are useful to evaluate the performance of servo. The license that governs the perf tests is included in the folder. Running benchmark cases automatically is left to future work. The update.py script is taken from mozjs and slightly adapted, so we can easily filter (and patch if this should be necessary in the future. Testing: This PR just adds the perf_tests, but does not use or modify them in any way. --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
81 lines
2.8 KiB
HTML
Vendored
81 lines
2.8 KiB
HTML
Vendored
<!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";
|
|
PerfTestRunner.forceLayout();
|
|
style.display = "none";
|
|
}
|
|
|
|
PerfTestRunner.measureRunsPerSecond({
|
|
description: "Measures performance of 3 layouts (using 2 different font-sizes) on a page containing random text.",
|
|
run: test
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|