-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(mutation): add deep recursive test
- Loading branch information
Showing
3 changed files
with
68 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/rrweb/test/html/benchmark-dom-mutation-deep-nested.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<html> | ||
<body></body> | ||
<script> | ||
function init() { | ||
const count = 1000; | ||
|
||
let roots = []; | ||
for (let i = 0; i < count; ++i) { | ||
const div = document.createElement('div'); | ||
document.body.appendChild(div); | ||
roots.push(div); | ||
} | ||
|
||
let tree_depth = 64; | ||
let children = [...roots]; | ||
while (tree_depth > 0) { | ||
for (let i = 0; i < children.length; i++) { | ||
const div = document.createElement('div'); | ||
children[i].appendChild(div); | ||
children[i] = div; | ||
} | ||
tree_depth--; | ||
} | ||
} | ||
|
||
init(); | ||
|
||
window.workload = () => { | ||
const divs = document.getElementsByTagName('div'); | ||
for (let div of divs) { | ||
div.classList.add('foo'); | ||
} | ||
}; | ||
</script> | ||
</html> |