--- id: wiki-2026-0508-브라우저-렌더링-프로세스-crp title: 브라우저 렌더링 프로세스 (CRP) category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Critical Rendering Path, CRP, 렌더링 파이프라인] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [browser, rendering, performance, web] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: javascript framework: web-platform --- # 브라우저 렌더링 프로세스 (CRP) ## 매 한 줄 > **"매 byte → pixel 의 6-stage pipeline"**. CRP는 HTML/CSS/JS bytes 가 actual pixels 가 되기 전 거치는 parse → DOM/CSSOM → Render Tree → Layout → Paint → Composite 단계. 매 stage 차단/지연 의 LCP, INP regression 의 root cause. ## 매 핵심 ### 매 6-stage pipeline - **Parse**: HTML byte stream → token → DOM. CSS bytes → CSSOM (render-blocking). - **Render Tree**: DOM + CSSOM merge, `display:none` 제외. - **Layout (Reflow)**: 매 element 의 geometric box (x, y, w, h) 계산. - **Paint**: pixels 의 layer 별 raster (text, color, image, shadow). - **Composite**: GPU 의 layer 합성 — `transform`, `opacity` 만 매 단계 처리 가능. ### 매 차단 요소 - CSS 매 default render-blocking — `
` 의 위치 의 영향. - ` ``` ### Layout thrashing 회피 ```javascript // 매 안 좋은 패턴 — read/write interleave 의 N forced reflow boxes.forEach(box => { const w = box.offsetWidth; // read (force layout) box.style.width = (w * 2) + 'px'; // write (invalidate) }); // 매 fix — batch read, batch write const widths = boxes.map(b => b.offsetWidth); // batch read boxes.forEach((b, i) => b.style.width = widths[i] * 2 + 'px'); // batch write ``` ### Composite-only animation ```css /* 매 GOOD — GPU compositor 의 처리, layout/paint skip */ .slide { transform: translateX(0); transition: transform 200ms ease-out; will-change: transform; /* hint to compositor */ } .slide.active { transform: translateX(100%); } /* 매 BAD — 매 frame 의 layout + paint 야기 */ .slide-bad { left: 0; transition: left 200ms; } ``` ### CSS containment (scope reflow) ```css .card { contain: layout style paint; /* 매 card 의 reflow 가 outer 에 전파 안 됨 */ content-visibility: auto; /* offscreen skip */ } ``` ### INP 최적화 — yield to main thread ```javascript async function processLargeList(items) { for (let i = 0; i < items.length; i++) { process(items[i]); if (i % 50 === 0) { await new Promise(r => setTimeout(r, 0)); // yield } } } // 매 modern API (2026) function yieldToMain() { return scheduler.yield ? scheduler.yield() : new Promise(r => setTimeout(r)); } ``` ### PerformanceObserver — measure CRP ```javascript new PerformanceObserver((list) => { for (const entry of list.getEntries()) { console.log(entry.name, entry.startTime, entry.duration); } }).observe({ type: 'largest-contentful-paint', buffered: true }); new PerformanceObserver((list) => { for (const e of list.getEntries()) { if (e.duration > 50) console.warn('Long task:', e); } }).observe({ type: 'longtask', buffered: true }); ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Hero image LCP 느림 | `` + `fetchpriority=high` | | Animation jank | `transform`/`opacity` 만, `will-change` hint | | 큰 list scroll lag | `content-visibility: auto` | | Form input INP > 200ms | `scheduler.yield()`, debounce | | Third-party script blocking | `async` + Partytown | **기본값**: defer non-critical JS, inline critical CSS, composite-only animation. ## 🔗 Graph - 부모: [[Web Performance]] · [[Core Web Vitals]] - 변형: [[Server-Side Rendering (SSR)]] · [[Streaming SSR]] - 응용: [[LCP 최적화]] · [[INP 최적화]] · [[CLS 최적화]] - Adjacent: [[CSS Containment]] · [[content-visibility]] · [[Speculation Rules API]] ## 🤖 LLM 활용 **언제**: jank/LCP/INP 회귀 진단, animation 최적화, third-party script 영향 분석. **언제 X**: 매 framework-specific reactivity (React reconciler) 매 별도 layer — CRP 만 으로 안 풀림. ## ❌ 안티패턴 - **`document.write` 사용**: parser block, modern browser 의 무시. - **synchronous XHR**: main thread block, INP 파괴. - **inline script after CSS**: CSSOM wait 의 parser stall. - **animate `width`/`top`**: 매 frame layout — composite-only 만 사용. - **`@import` in CSS**: serialize CSS download — `` 의 사용. ## 🧪 검증 / 중복 - Verified (web.dev — Critical Rendering Path, Chrome DevTools Performance panel docs). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — CRP 6-stage pipeline + LCP/INP patterns |