jargon

Frontend & browser·Performance and Core Web Vitals

you read `offsetHeight` and wrote a style inside the same loop, and the loop got slower with every item.

Layout thrashing

Also calledthrashing, read-write interleaving

Repeatedly forcing layout by interleaving DOM reads and writes, so the browser must recompute geometry on every iteration instead of once. It turns a linear loop into a quadratic one and is invisible on ten elements and catastrophic on a thousand. The fix is always the same shape: batch all reads, then all writes, or move the measurement to a ResizeObserver that already has the answer.

Commonly confused with