forked from rrweb-io/rrweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: optimize performance of the DoubleLinkedList get (rrweb-io#1220)
* perf: optimize performance of the DoubleLinkedList get * fix: delete addedNodeIndexArr
- Loading branch information
1 parent
5aba92f
commit 48b5f7b
Showing
4 changed files
with
60 additions
and
2 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 | ||
--- | ||
|
||
perf: optimize performance of the DoubleLinkedList get |
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
37 changes: 37 additions & 0 deletions
37
packages/rrweb/test/html/benchmark-dom-mutation-add-and-move.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,37 @@ | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
</body> | ||
<script> | ||
function appendNodes(parentNode, total) { | ||
const el = document.createElement('div'); | ||
for (let i = 0; i < total; i++) { | ||
const div = document.createElement('div'); | ||
div.innerHTML = `div-${i + 1}`; | ||
el.append(div); | ||
} | ||
parentNode.append(el); | ||
return el; | ||
} | ||
|
||
function addAndMove() { | ||
const app = document.getElementById('app'); | ||
|
||
const elContainer = appendNodes(app, 10000); | ||
|
||
const newAppContainer = document.createElement('div'); | ||
|
||
newAppContainer.append(elContainer); | ||
|
||
document.body.append(newAppContainer); | ||
|
||
app.remove(); | ||
|
||
// necessary | ||
appendNodes(document.body, 1); | ||
} | ||
window.workload = () => { | ||
addAndMove(); | ||
}; | ||
</script> | ||
</html> |