rrweb
rrweb copied to clipboard
Improve mutation processing performance
Refactor record time mutation processing to improve performance
- smarter 'iteration' through the
this.addedSetso that we start with nodes which already have the requirednextIdandparentId - take advantage of siblings sharing the same parent, so only do parent related calculations once instead of repeatedly for every child node
- inline pushAdd (and getNextId) as we only need a single run over them
This solves pathological cases where nodes from the addedSet were pushed onto the secondary addList, possibly multiple times as pushAdd was called again each time the nextId/parentId requirements weren't met.
Previous efforts in this direction were
- #1398 "traverse children in reverse order"
- #1302 "optimize random shuffled addList"
Also related is #1277 "refactor recursive procedure to iterative" which we could also incorporate on top of this as it should provide orthogonal performance gains — in order to 'grasp the nettle' all at once in terms of possible breakage.