Have you ever come across (or event built!) a cool, modern, sleek, animation-heavy website... and opened it on mobile only to see that it runs like Alan Wake 2 on a 2003 Dell Inspiron? What is layout thrashing? Layout thrashing, a.k.a. forced synchronous reflow, occurs when the browser is continuously forced to drop its optimized queueing of layout and style recalculations and do it ASAP because a script running needs to know the latest layout measurements. Because layout re-calculation and repainting are resource-heavy operations, if the browser is forced to do them too often and not "at the right time", this leads to very jittery laggy and possibly unresponsive page. What causes it? As a user interacts with the page and layout changes or animations play, the browser has to keep re-rendering the latest version of a page. It does in roughly two distinct steps:

Mar 1, 2025 - 13:11
 0

Have you ever come across (or event built!) a cool, modern, sleek, animation-heavy website... and opened it on mobile only to see that it runs like Alan Wake 2 on a 2003 Dell Inspiron?

What is layout thrashing?

Layout thrashing, a.k.a. forced synchronous reflow, occurs when the browser is continuously forced to drop its optimized queueing of layout and style recalculations and do it ASAP because a script running needs to know the latest layout measurements.

Because layout re-calculation and repainting are resource-heavy operations, if the browser is forced to do them too often and not "at the right time", this leads to very jittery laggy and possibly unresponsive page.

What causes it?

As a user interacts with the page and layout changes or animations play, the browser has to keep re-rendering the latest version of a page. It does in roughly two distinct steps: