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>
66 lines
1.8 KiB
HTML
Vendored
66 lines
1.8 KiB
HTML
Vendored
<!DOCTYPE html>
|
|
<body>
|
|
<pre id="log"></pre>
|
|
<script src="../resources/runner.js"></script>
|
|
<div id="sandbox" style="display:none"></div>
|
|
<script>
|
|
var sandbox = document.getElementById('sandbox');
|
|
var node = sandbox;
|
|
for (var i = 0; i < 200; ++i)
|
|
node = node.appendChild(document.createElement('div'));
|
|
var observing = false;
|
|
|
|
var observer = new WebKitMutationObserver(listener);
|
|
var tickledSpan = document.createElement('span');
|
|
observer.observe(tickledSpan, {attributes: true});
|
|
|
|
function resetState() {
|
|
window.start = null;
|
|
window.numRuns = 25;
|
|
window.times = [];
|
|
}
|
|
|
|
function runAgain() {
|
|
tickledSpan.setAttribute('data-foo', numRuns);
|
|
}
|
|
|
|
function hideFromObservation(func) {
|
|
if (observing)
|
|
observer.disconnect();
|
|
func();
|
|
if (observing)
|
|
observer.observe(sandbox, {childList: true, subtree: true});
|
|
}
|
|
|
|
function listener(mutations) {
|
|
if (start) {
|
|
var time = Date.now() - start;
|
|
times.push(time);
|
|
PerfTestRunner.log(time);
|
|
}
|
|
if (numRuns-- >= 0) {
|
|
runAgain();
|
|
hideFromObservation(function() {
|
|
for (var i = 0; i < 50000; ++i)
|
|
node.appendChild(document.createElement('div'));
|
|
});
|
|
start = Date.now();
|
|
while (node.firstChild)
|
|
node.removeChild(node.firstChild);
|
|
} else {
|
|
PerfTestRunner.logStatistics(times);
|
|
if (!observing) {
|
|
observing = true;
|
|
resetState();
|
|
PerfTestRunner.log('\n------------\n');
|
|
PerfTestRunner.log('Running ' + numRuns + ' times with observation');
|
|
setTimeout(runAgain, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
resetState();
|
|
PerfTestRunner.log('Running ' + numRuns + ' times without observation');
|
|
window.addEventListener('load', runAgain);
|
|
</script>
|
|
</body>
|