[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -2,99 +2,154 @@
id: wiki-2026-0508-브라우저-렌더링-파이프라인-critical-renderin
title: 브라우저 렌더링 파이프라인(Critical Rendering Path)
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: []
aliases: [Critical Rendering Path, CRP, 렌더링 파이프라인]
duplicate_of: none
source_trust_level: A
confidence_score: 0.92
tags: [uncategorized]
confidence_score: 0.95
verification_status: applied
tags: [frontend, browser, rendering, performance, web-vitals]
raw_sources: []
last_reinforced: 2026-05-08
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: unspecified
framework: unspecified
language: javascript
framework: browser
---
# [[브라우저 렌더링 파이프라인([[Critical Rendering Path]])]]
# 브라우저 렌더링 파이프라인(Critical Rendering Path)
## 📌 한 줄 통찰 (The Karpathy Summary)
브라우저 렌더링 파이프라인(Critical Rendering Path, CRP)은 브라우저가 HTML, CSS, [[JavaScript]] 코드를 수신하여 화면 픽셀로 변환하기 위해 거치는 일련의 핵심 단계입니다 [1, 2]. 이 파이프라인은 주로 DOM 및 [[CSSOM]] 생성, 렌더 트리 구축, 레이아웃, 페인트, 그리고 합성 단계로 이루어집니다 [3]. 이 경로를 최적화하는 것은 초기 렌더링 속도(Time to first render)를 높이고 60FPS의 부드러운 사용자 상호작용을 보장하기 위한 웹 성능 최적화의 핵심입니다 [4, 5].
## 한 줄
> **"매 HTML/CSS/JS 의 화면 픽셀로 도달하는 순차적 stage chain"**. 매 Parse → Style → Layout → Paint → Composite 의 5단계 — 매 stage 의 cost 의 understand 의 LCP/INP/CLS 의 optimize 의 critical path.
## 📖 구조화된 지식 (Synthesized Content)
브라우저 렌더링 파이프라인은 다음과 같은 세부적인 과정을 거쳐 실행됩니다.
## 매 핵심
* **[[DOM(Document Object Model)]] 구축**
브라우저가 서버로부터 HTML 데이터를 받으면, 이를 바이트 단위에서 문자, 토큰, 노드로 변환하여 점진적(incremental)으로 DOM 트리를 구성합니다 [1, 6]. 파싱 중 비차단(non-[[Blocking]]) 리소스를 만나면 요청을 보내고 파싱을 계속하며, 프리로드 스캐너(Preload Scanner)가 백그라운드에서 CSS, 웹 폰트 등 우선순위가 높은 리소스를 미리 요청하여 병목을 줄입니다 [7].
* **[[CSSOM(CSS Object Model)]] 구축**
HTML과 별개로 브라우저는 CSS를 파싱하여 스타일 규칙과 계층 구조를 나타내는 CSSOM 트리를 생성합니다 [8, 9]. DOM 생성과 달리 CSSOM은 **렌더링을 차단(Render-blocking)**하는 속성을 지닙니다. 즉, 브라우저는 모든 CSS를 다운로드하고 파싱을 완료할 때까지 페이지 렌더링을 중단하여, 스타일이 입혀지지 않은 콘텐츠가 화면에 번쩍이는 현상(FOUC)을 방지합니다 [8, 10].
* **렌더 트리([[Render Tree]]) 생성**
DOM과 CSSOM이 준비되면, 두 트리를 결합하여 **화면에 실제로 표시되는 노드들만 포함된 렌더 트리**를 구축합니다 [11, 12]. `<script>`, `<meta>` 같은 태그나 CSS의 `display: none`이 적용된 요소는 렌더 트리에서 완전히 제외되지만, 화면에 공간을 차지하는 `visibility: hidden`이 적용된 요소는 포함됩니다 [11-13].
* **레이아웃(Layout) 또는 리플로우(Reflow)**
렌더 트리가 완성되면, 브라우저는 뷰포트의 크기를 기준으로 각 요소가 화면의 어느 위치에, 어느 정도의 크기(기하학적 형태)로 배치될지 정확히 계산합니다 [14-16]. 창 크기가 조절되거나 JavaScript로 DOM 요소의 크기 및 위치를 조작할 때마다 이 계산이 다시 발생하며(**리플로우**), 이는 브라우저에 큰 계산 부담을 줍니다 [17-19].
* **페인트(Paint)와 합성(Compositing)**
레이아웃 계산이 끝나면 요소에 색상, 텍스트, 그림자, 테두리 등 시각적 속성을 적용하여 화면의 실제 픽셀로 변환하는 페인트(또는 리페인트) 단계가 진행됩니다 [17, 20]. 마지막으로, 성능 최적화를 위해 일부 요소(예: `<video>`, `<canvas>`, 특정 CSS 속성 적용 요소)가 별도의 레이어로 나뉘어 그려졌다면, 브라우저가 이들을 올바른 순서로 겹쳐서 최종 화면을 완성하는 **합성(Compositing)** 단계를 거칩니다 [21, 22]. GPU를 활용해 이 과정을 가속화할 수도 있습니다 [23, 24].
### 매 5 stages
1. **Parse**: HTML → DOM, CSS → CSSOM (parallel, but CSS blocks render).
2. **Style**: DOM + CSSOM → Render Tree (visible nodes only — `display:none` excluded).
3. **Layout (Reflow)**: geometry 계산 — x/y/width/height.
4. **Paint**: pixel 채우기 — color, image, shadow, text.
5. **Composite**: layer 합성 — GPU 의 transform/opacity 의 처리.
## 🔗 지식 연결 (Graph)
- **Related Topics:** [[DOM(Document Object Model)]], [[CSSOM(CSS Object Model)]], 리플로우와 리페인트([[Reflow and Repaint]]), 가상 DOM([[Virtual DOM]]), [[웹 성능 최적화(Web Performance [[Optimization]])]]
- **Projects/Contexts:** 최초 렌더링 시간(Time to First Render) 단축, 단일 페이지 애플리케이션(SPA)의 CSR 및 SSR 전략
- **Contradictions/Notes:** 동기식 JavaScript는 기본적으로 파서를 차단([[Parser]]-blocking)하여 결과적으로 렌더링 파이프라인 전체를 지연시키므로, `async``defer` 속성을 활용해 렌더링 경로를 방해하지 않도록 처리하는 것이 공통적인 모범 사례로 권장됩니다 [7, 25, 26].
### 매 blocking resources
- **CSS**: render-blocking — CSSOM 의 완성 의 wait.
- **JS (sync)**: parser-blocking — DOM 의 build 의 pause.
- **JS (`async`)**: 매 download parallel, execute when ready (parser pause).
- **JS (`defer`)**: 매 download parallel, execute after DOMContentLoaded.
---
*Last updated: 2026-04-25*
### 매 layer-promote triggers
- `transform: translateZ(0)` / `will-change: transform`.
- `position: fixed` (modern Chromium).
- `<video>`, `<canvas>`, animated `transform/opacity`.
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
## 💻 패턴
**언제 이 지식을 쓰는가:**
- *(TODO)*
**언제 쓰면 안 되는가:**
- *(TODO)*
## 🧪 검증 상태 (Validation)
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
## 🧬 중복 검사 (Duplicate Check)
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
- **과거 데이터와의 충돌:** 없음
- **정책 변화:** 없음
## 🕓 변경 이력 (Changelog)
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
## 💻 코드 패턴 (Code Patterns)
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
```text
# TODO
### Critical CSS inlining
```html
<head>
<style>
/* above-the-fold CSS only — 14KB 이내 */
body { margin: 0; font-family: system-ui; }
.hero { height: 100vh; background: #000; }
</style>
<link rel="preload" href="/main.css" as="style"
onload="this.onload=null;this.rel='stylesheet'">
</head>
```
## 🤔 의사결정 기준 (Decision Criteria)
### Composite-only animation (cheap)
```css
/* O — composite layer 만 — 60fps 안정 */
.card { transition: transform 200ms, opacity 200ms; }
.card:hover { transform: translateY(-4px); opacity: 0.9; }
**선택 A를 써야 할 때:**
- *(TODO)*
/* X — layout + paint trigger — jank */
.bad { transition: top 200ms, height 200ms; }
```
**선택 B를 써야 할 때:**
- *(TODO)*
### Reflow 의 batch (read-then-write)
```js
// X — interleave read/write — forced reflow per write
elements.forEach(el => {
const w = el.offsetWidth; // read (force layout)
el.style.width = (w * 2) + 'px'; // write (invalidate)
});
**기본값:**
> *(TODO)*
// O — batch read, then batch write
const widths = elements.map(el => el.offsetWidth);
elements.forEach((el, i) => el.style.width = (widths[i] * 2) + 'px');
```
## ❌ 안티패턴 (Anti-Patterns)
### Resource priority hint
```html
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preconnect" href="https://api.example.com">
<img src="/hero.jpg" fetchpriority="high">
<img src="/below-fold.jpg" loading="lazy" fetchpriority="low">
```
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
### Web Vitals 의 측정 (PerformanceObserver)
```js
new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (entry.name === 'first-contentful-paint') console.log('FCP', entry.startTime);
}
}).observe({ type: 'paint', buffered: true });
new PerformanceObserver((list) => {
const lcp = list.getEntries().at(-1);
console.log('LCP', lcp.renderTime || lcp.loadTime);
}).observe({ type: 'largest-contentful-paint', buffered: true });
```
### `content-visibility` (off-screen skip)
```css
/* 매 viewport 밖 section 의 layout/paint 의 skip */
.section { content-visibility: auto; contain-intrinsic-size: 800px; }
```
### `requestIdleCallback` 의 non-critical work
```js
requestIdleCallback(() => {
prefetchRoutes();
reportAnalytics();
}, { timeout: 2000 });
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| LCP 느림 | Critical CSS inline + preload hero image + `fetchpriority="high"` |
| INP 느림 | long task 의 break (`scheduler.yield()`), event handler 의 simplify |
| CLS 발생 | image/iframe 의 width/height 의 명시, `font-display: optional` |
| Animation jank | `transform/opacity` 만 의 사용, `will-change` 의 sparingly |
| Long list | `content-visibility: auto` + `contain-intrinsic-size` |
**기본값**: 매 Critical CSS inline (14KB), JS `defer`, image lazy + dimensions, transform-only animation.
## 🔗 Graph
- 부모: [[브라우저 동작 원리]] · [[Web Vitals]]
- 변형: [[Reflow vs Repaint]] · [[Compositor Thread]]
- 응용: [[성능 최적화(Reflow & Repaint)]] · [[Lighthouse 의 사용]]
- Adjacent: [[Service Worker Caching]] · [[HTTP/2 Push 의 deprecation]]
## 🤖 LLM 활용
**언제**: Web Vitals regression 의 분석, layout thrash 의 detect, optimization 의 prioritize.
**언제 X**: Real User Monitoring (RUM) 의 raw data 의 aggregate (specialized tooling 의 use).
## ❌ 안티패턴
- **모든 element 에 `will-change`**: 매 GPU memory 의 explosion — 매 sparingly.
- **Sync JS 의 `<head>`**: 매 parser block — 매 `defer` 의 사용.
- **`@import` chain**: 매 sequential CSS load — 매 `<link>` 의 use.
- **Layout-trigger animation**: 매 `top/left/width` 의 transition — 매 `transform` 의 substitute.
## 🧪 검증 / 중복
- Verified (web.dev/learn/performance, Chrome DevTools docs, Ilya Grigorik CRP).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — CRP 5 stages + composite animation + Web Vitals 의 정리 |