"매 layout(=reflow) 의 비싸고, paint 의 cheap-er, composite 의 cheapest". 매 DOM/CSS write 의 invalidate 의 trigger — geometry change → reflow + repaint, color-only change → repaint, transform/opacity → composite-only. Layout thrashing 의 batch read/write 의 fix.
매 핵심
매 cost ladder
Composite only (cheap, 60fps): transform, opacity, filter (some).
매 pending invalidation 의 있을 때 read → 매 browser 의 immediate layout 의 trigger.
💻 패턴
Layout thrash 의 fix (read-then-write)
// X — N reflow (each iteration forces layout)
boxes.forEach(b=>{constw=b.offsetWidth;b.style.width=(w+10)+'px';});// O — 1 reflow (read all, then write all)
constwidths=boxes.map(b=>b.offsetWidth);boxes.forEach((b,i)=>b.style.width=(widths[i]+10)+'px');
constlist=document.getElementById('list');constfragment=document.createDocumentFragment();for(constitemofitems){constli=document.createElement('li');li.textContent=item.name;fragment.appendChild(li);}list.appendChild(fragment);// 1 reflow, not N
transform 의 substitute (animation)
/* X — top change → reflow per frame */@keyframesslide-bad{from{top:0}to{top:100px}}/* O — transform → composite only */@keyframesslide-good{from{transform:translateY(0)}to{transform:translateY(100px)}}
will-change (sparingly)
/* 매 animation 직전 의 hint, 매 finish 후 remove */.card{will-change:transform;}.card.done{will-change:auto;}
contain (CSS containment)
/* 매 subtree 의 layout/paint 의 isolate — outer 의 invalidation 의 not propagate */.widget{contain:layoutpaint;}
Position fixed/sticky (composite layer)
.toolbar{position:sticky;top:0;/* GPU layer — scroll 시 reflow 없음 */}
언제: layout thrash 의 detect (read-write interleave pattern), animation property 의 review.
언제 X: actual paint profiling — Chrome DevTools Performance/Layers panel 의 use.
❌ 안티패턴
will-change everywhere: 매 GPU memory exhaustion.
top/left animation: 매 reflow per frame — transform 의 substitute.
scroll handler 의 layout read: 매 thrash — IntersectionObserver 의 use.
innerHTML 의 loop: 매 N reflow — fragment 의 build.
🧪 검증 / 중복
Verified (web.dev/articles/animations-guide, Paul Lewis "Avoid Large, Complex Layouts", CSSOM View spec).
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — reflow trigger + 8 패턴 + 결정 기준 의 정리