-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(mutation): refactor parent removed detection to iterative proced…
…ure (#1489) * perf(mutation): add deep tree benchmark * perf(mutation): use iterative procedure * perf(mutation): run formatter * perf(mutation): add changeset
- Loading branch information
Showing
4 changed files
with
50 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"rrweb": patch | ||
--- | ||
|
||
Optimize performance of isParentRemoved by converting it to an iterative procedure |
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
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
<html> | ||
<body></body> | ||
<script> | ||
function init() { | ||
const count = 100; | ||
|
||
let roots = []; | ||
for (let i = 0; i < count; ++i) { | ||
const div = document.createElement('div'); | ||
document.body.appendChild(div); | ||
roots.push(div); | ||
} | ||
|
||
let tree_depth = 256; | ||
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--; | ||
} | ||
} | ||
|
||
window.workload = () => { | ||
document.body.innerHTML = ''; | ||
init(); | ||
}; | ||
</script> | ||
</html> |