docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
---
|
||||
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 — `<head>` 의 위치 의 영향.
|
||||
- `<script>` 매 default parser-blocking — `defer` / `async` 의 회피.
|
||||
- Synchronous JS 매 layout 강제 (forced reflow / layout thrashing).
|
||||
|
||||
### 매 응용
|
||||
1. LCP 최적화 — critical CSS inline + preload hero image.
|
||||
2. INP 최적화 — long task 분할, `requestIdleCallback` 활용.
|
||||
3. Composite-only animation — `transform` / `opacity` 만 60fps 보장.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Critical CSS inline (LCP < 2.5s)
|
||||
```html
|
||||
<head>
|
||||
<style>
|
||||
/* Above-the-fold critical CSS only */
|
||||
body { margin: 0; font: 16px/1.5 system-ui; }
|
||||
.hero { height: 100vh; background: #0a0a0a; }
|
||||
</style>
|
||||
<link rel="preload" href="/fonts/inter.woff2" as="font" crossorigin>
|
||||
<link rel="stylesheet" href="/full.css" media="print" onload="this.media='all'">
|
||||
</head>
|
||||
```
|
||||
|
||||
### Defer non-critical JS
|
||||
```html
|
||||
<!-- parse 안 차단 — DOM 완료 후 실행 -->
|
||||
<script defer src="/app.js"></script>
|
||||
<!-- 매 즉시 download but execution 매 비동기 -->
|
||||
<script async src="/analytics.js"></script>
|
||||
```
|
||||
|
||||
### 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 느림 | `<link rel=preload>` + `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 Optimization (INP, LCP, CLS)|Core Web Vitals]]
|
||||
- 변형: [[Server Side Rendering (SSR)|Server-Side Rendering (SSR)]] · [[Streaming SSR]]
|
||||
|
||||
## 🤖 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 — `<link>` 의 사용.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- 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 |
|
||||
Reference in New Issue
Block a user