Layout Thrashing
Interleaving DOM reads that force layout with writes, in a loop, so the browser recomputes layout over and over. Batch all reads, then all writes, to avoid it.
Read offsetTop, set height, repeat — each pass thrashes layout again.
readwritereadwrite
forced layouts: 0
Tap the example to replay it · press and hold to slow it down