forked from rrweb-io/rrweb
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add benchmarks for text masking rrweb-io#1096
- Loading branch information
1 parent
3b1a859
commit 8239b53
Showing
2 changed files
with
86 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<html> | ||
<body></body> | ||
<script> | ||
window.workload = () => { | ||
const branches = 1000; | ||
const depth = 10; | ||
const frag = document.createDocumentFragment(); | ||
for (let b = 0; b < branches; b++) { | ||
const node = document.createElement('div'); | ||
let d = 0; | ||
node.setAttribute('branch', b.toString()); | ||
node.setAttribute('depth', d.toString()); | ||
node.classList.add('rr-mask'); | ||
let current = node; | ||
while (d < depth - 1) { | ||
d++; | ||
const child = document.createElement('div'); | ||
child.setAttribute('branch', b.toString()); | ||
child.setAttribute('depth', d.toString()); | ||
child.classList.toggle('rr-unmask', d === 1); | ||
current.appendChild(child); | ||
current = child; | ||
} | ||
current.innerText = 'some text'; | ||
frag.appendChild(node); | ||
} | ||
document.body.appendChild(frag); | ||
}; | ||
</script> | ||
</html> |