Skip to content

Commit

Permalink
perf(rrweb): optimize random shuffled addList
Browse files Browse the repository at this point in the history
  • Loading branch information
wfk007 authored and mdellanoce committed Nov 7, 2023
1 parent d8276f1 commit a6235bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,13 @@ export default class MutationBuffer {
if (this.processedNodeManager.inOtherBuffer(n, this)) return;

// if n is added to set, there is no need to travel it and its' children again
if (this.addedSet.has(n) || this.movedSet.has(n)) return;
if (this.addedSet.has(n)) {
// update the order of added nodes in addedSet for the `emit` phase
this.addedSet.delete(n);
this.addedSet.add(n);
return;
}
if (this.movedSet.has(n)) return;

if (this.mirror.hasNode(n)) {
if (isIgnored(n, this.mirror)) {
Expand Down

0 comments on commit a6235bd

Please sign in to comment.