3 ms·
The main performance gotcha to watch out for with hand rolled DOM manipulation is causing a reflow. Pretty much if you make changes to a DOM element and then r
by Widdershin 7y ago
The main performance gotcha to watch out for with hand rolled DOM manipulation is causing a reflow.
Pretty much if you make changes to a DOM element and then read a computed value from it before a new frame renders (like dimensions etc), the browser has to recalculate the page layout before it can return an answer.
Fast: Read -> Modify -> Paint
Slow: Modify -> Read (reflow!) -> Paint
This generally isn’t an issue but if you’re seeing hiccups it’s either GC run wild, synchronous code chewing up the frame budget or frequent reflows.