Glossary coding Term Page

Layout Thrashing

Rapidly mixing layout reads and writes that trigger needless recalculations.

layout-thrashing #performance#dom
Korean version

Aliases

layout trashinglayout jank

Prerequisites

Related Concepts

Core Idea

Layout thrashing happens when scripts ask for layout metrics—like offsetHeight—right after mutating the DOM, forcing the browser to recalc immediately. Repeating that pattern per item multiplies reflow cost and tanks frame rates.

Why It Matters Here

Mathbong demonstrates thrashing so readers see how batching via DocumentFragment or scheduling via requestAnimationFrame removes the sawtooth pattern. Keeping this term explicit helps teams audit render helpers before they grow into performance hotspots.

Posts Mentioning This Concept