-
-
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(rrweb): attribute mutation optimization (#1343)
- Loading branch information
1 parent
9c6edfe
commit 05478c3
Showing
4 changed files
with
36 additions
and
3 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 | ||
--- | ||
|
||
use WeakMap for faster attributeCursor lookup while processing attribute mutations |
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
21 changes: 21 additions & 0 deletions
21
packages/rrweb/test/html/benchmark-dom-mutation-attributes.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,21 @@ | ||
<html> | ||
<body></body> | ||
<script> | ||
function init() { | ||
const count = 10000; | ||
for (let i = 0; i < count; ++i) { | ||
const div = document.createElement('div'); | ||
document.body.appendChild(div); | ||
} | ||
} | ||
|
||
init(); | ||
|
||
window.workload = () => { | ||
const divs = document.getElementsByTagName('div'); | ||
for (let div of divs) { | ||
div.classList.add('foo'); | ||
} | ||
}; | ||
</script> | ||
</html> |