Layout thrashing
Repeated cycles of reflow and repaint caused by JavaScript alternately reading and writing layout properties.
Layout thrashing typically happens in loops. The classic pattern: read `element.offsetHeight`, modify `element.style.height`, read `offsetHeight` again. Each read forces the browser to flush pending writes and recalculate layout synchronously. In a loop over thousands of elements, this can tank frame rate from 60 fps to single digits.
The solution is to batch reads before writes. Collect all layout values into variables first, then apply all DOM changes together. Libraries like GSAP and modern frameworks handle this automatically.