4 ms·
In my experience, Mutation Observers can be very punishing in terms of performance if you have large DOM structures, especially on page load. On the other hand
by egeozcan 6y ago
In my experience, Mutation Observers can be very punishing in terms of performance if you have large DOM structures, especially on page load.
On the other hand, if you have an SPA[0] that renders as little as possible, I'd say, go wild :)
[0]: I understand DOM size should be orthogonal to your rendering method but "In Real World (c)", that's usually not the case for some reason.
- modeless 6y agoPerformance during recording shouldn't be too much of an issue, especially if demos are scripted with Selenium as suggested.
- onion2k 6y agoIn my experience, Mutation Observers can be very punishing in terms of performance if you have large DOM structures, especially on page load. Mutation events are what kills performance, not mutation observers.
- db48x 6y agoYes, though browsers have long been optimizing this by simply never processing mutation events unless the page has event handlers for them.
- roca 6y agoMutationObserver is much more efficient than mutation events because it can group events into batches, vastly reducing the number of event handler callbacks when you're observing whole documents.
- ed 6y agoMutation Summary is a nice little library to help with this. It coalesces mutation observer events so you get one minimal set of changes per animation frame. https://github.com/rafaelw/mutation-summary#readme https://github.com/rafaelw/mutation-summary#readme