Bug 1899597 - Add a perf test for DOM removal with positional pseudo-classes. r=perftest-reviewers,sparky

Differential Revision: https://phabricator.services.mozilla.com/D212038
This commit is contained in:
Emilio Cobos Álvarez 2024-06-05 11:48:24 +00:00
parent 631a06aa55
commit 9aa3960059
3 changed files with 44 additions and 0 deletions

View file

@ -39,4 +39,6 @@
% http://localhost/tests/perf-reftest-singletons/remove-front-has-pseudo.html
% http://localhost/tests/perf-reftest-singletons/append-nth-edge-has-pseudo.html
% http://localhost/tests/perf-reftest-singletons/insert-nth-edge-has-pseudo.html
% http://localhost/tests/perf-reftest-singletons/remove-children-positional-1.html
% http://localhost/tests/perf-reftest-singletons/remove-children-positional-2.html
# When modifying this list, please also update build/pgo/index.html (If relevant to profile-guided optimzation).

View file

@ -0,0 +1,21 @@
<!doctype html>
<script src="util.js"></script>
<style>
:nth-child(2n - 1) {
color: green;
}
</style>
<div id="container"></div>
<script>
onload = function() {
const kElementCount = 10000;
for (let i = 0; i < kElementCount; ++i)
container.appendChild(document.createElement("div"));
flush_layout();
perf_start();
while (container.firstChild)
container.firstChild.remove();
flush_layout();
perf_finish();
};
</script>

View file

@ -0,0 +1,21 @@
<!doctype html>
<script src="util.js"></script>
<style>
:nth-child(2n - 1) {
color: green;
}
</style>
<div id="container"></div>
<script>
onload = function() {
const kElementCount = 10000;
for (let i = 0; i < kElementCount; ++i)
container.appendChild(document.createElement("div"));
flush_layout();
perf_start();
while (container.lastChild)
container.lastChild.remove();
flush_layout();
perf_finish();
}
</script>