Layout Thrashing & Forced Reflow Playground

Real name boards: interleaved reads and writes, or all reads then all writes: how many layouts does each force? Every read is timed with performance.now. An…

Why it matters

Forced layout is one of the most common sources of jank: animation in JavaScript, old libraries, “measure then set” code inside a loop. One wrong loop can add a dozen milliseconds to a frame and make scrolling or animation stutter. The pattern is easy to fix once it is recognised.

The key idea

Reading geometry after a write forces layout in the middle of a script

Common mistakes

Try it in this playground