mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02: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>
54 lines
1.3 KiB
HTML
54 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../resources/runner.js"></script>
|
|
<style>
|
|
[attr=root] [attr=child] {}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script>
|
|
function addChildren(element, numChildren, idPrefix)
|
|
{
|
|
for (var i = 0; i < numChildren; i++) {
|
|
var child = document.createElement("div");
|
|
child.id = idPrefix + i;
|
|
element.appendChild(child);
|
|
}
|
|
}
|
|
|
|
function makeTree(element, depth, fanOut, idPrefix)
|
|
{
|
|
if (depth <= 0)
|
|
return;
|
|
addChildren(element, fanOut, idPrefix);
|
|
for (var child = element.firstChild; child.nextSibling; child = child.nextSibling) {
|
|
makeTree(child, depth - 1, fanOut, child.id);
|
|
}
|
|
if (child)
|
|
makeTree(child, depth - 1, fanOut, child.id);
|
|
}
|
|
|
|
var root = document.querySelector("#root");
|
|
makeTree(root, 6, 5, "child");
|
|
|
|
var child = document.querySelector("#child012341");
|
|
child.setAttribute("attr", "child");
|
|
var runFunction = function()
|
|
{
|
|
root.offsetHeight; // force recalc style
|
|
root.setAttribute("attr" , "root");
|
|
root.offsetHeight;
|
|
root.removeAttribute("attr");
|
|
}
|
|
|
|
PerfTestRunner.measureRunsPerSecond({
|
|
description: "Measures performance of the CSS attribute descendant selector ([a=b] [c=d]).",
|
|
run: runFunction
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|