9148c358d0
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 폴더 제거.
5.1 KiB
5.1 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-레이아웃-스래싱-layout-thrashing | 레이아웃 스래싱 (Layout Thrashing) | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
레이아웃 스래싱 (Layout Thrashing)
매 한 줄
"매 layout thrashing = read DOM geometry → write style → read DOM 매 반복 — 매 force sync layout 매번". 매 브라우저 매 batch reflow 의 X — 매 즉시 reflow 강제 — 매 100x 느림. 매 해결 = 매 read 모두 batch → 매 write 모두 batch.
매 핵심
매 트리거 (read = force layout)
offsetTop/Left/Width/Height.clientTop/Left/Width/Height.scrollTop/Left/Width/Height.getBoundingClientRect().getComputedStyle()(some properties).innerText(특정 case).
매 메커니즘
- 매 write (
el.style.x = ...) — 매 layout invalidate, 매 brower 매 batch 대기. - 매 read (
el.offsetWidth) — 매 latest geometry 필요 — 매 강제 reflow. - 매 loop 안 read/write alternate — 매 매번 reflow — 매 thrashing.
매 해결
- Batch: read 모두 → write 모두.
- Cache: 매 1회 read, 매 변수 저장.
- rAF: read in current frame, write in next frame.
- FastDOM library — read/write queue.
- CSS containment:
contain: layout— 매 thrashing 매 isolate.
💻 패턴
Anti — 매 thrashing
const items = document.querySelectorAll('.item');
items.forEach(el => {
// 매 read → 매 write → 매 read → 매 write — 매 thrashing
el.style.width = el.offsetWidth + 10 + 'px';
});
// 매 100 items → 매 100 layouts
Fix — batch
const items = document.querySelectorAll('.item');
// 매 phase 1: read 모두
const widths = Array.from(items).map(el => el.offsetWidth);
// 매 phase 2: write 모두
items.forEach((el, i) => {
el.style.width = widths[i] + 10 + 'px';
});
// 매 1 layout
rAF read/write split
function syncSizes() {
// 매 current frame: read
const heights = Array.from(rows).map(r => r.offsetHeight);
requestAnimationFrame(() => {
// 매 next frame: write
rows.forEach((r, i) => {
r.style.minHeight = heights[i] + 'px';
});
});
}
FastDOM
import fastdom from 'fastdom';
fastdom.measure(() => {
const w = el.offsetWidth;
fastdom.mutate(() => {
el.style.width = w + 10 + 'px';
});
});
// 매 internally batch — 매 1 layout per frame
ResizeObserver (매 read 필요 X)
const ro = new ResizeObserver(entries => {
for (const entry of entries) {
const { width, height } = entry.contentRect; // 매 already computed
entry.target.dataset.width = width; // 매 write — 매 layout 의 X
}
});
ro.observe(element);
CSS Containment (isolate)
.widget {
contain: layout; /* 매 widget 내부 변경 — 매 outer 매 reflow 의 X */
}
DevTools 측정
performance.mark('layout-start');
heavyOperation();
performance.mark('layout-end');
performance.measure('layout', 'layout-start', 'layout-end');
// 매 DevTools Performance panel — 매 purple "Layout" bar — 매 thrashing 표시
Virtual list (대량 item)
// 매 모든 item layout — 매 X
// 매 visible 만 render — 매 react-virtual / @tanstack/virtual
import { useVirtualizer } from '@tanstack/react-virtual';
const rowVirtualizer = useVirtualizer({
count: 10000,
getScrollElement: () => parentRef.current,
estimateSize: () => 40,
});
매 결정 기준
| 상황 | 접근 |
|---|---|
| Loop 안 size 읽고 변경 | batch read → batch write |
| 비동기 read/write | rAF split |
| Element resize 감지 | ResizeObserver |
| Component-level isolation | contain: layout |
| 1000+ rows | Virtualization |
| Library 매 abstraction | FastDOM |
기본값: read all → write all + 매 ResizeObserver (size 감지) + 매 Virtual list (대량).
🔗 Graph
- 부모: 리플로우 및 리페인트(Reflow and Repaint) · Web Performance
- 변형: Forced Synchronous Layout
- Adjacent: ResizeObserver
🤖 LLM 활용
언제: jank 디버깅, "왜 scroll 느림", DevTools Performance 분석. 언제 X: 매 framework-specific (React reconciler) 내부 — 매 framework docs.
❌ 안티패턴
- Loop 안 read+write: 매 thrashing 의 정의.
offsetWidthafter style write: 매 force layout.- jQuery
.css()chain: 매 read/write 매 mix. scrollToppolling rAF: 매 ScrollObserver/IntersectionObserver 의 사용.- 모든 row layout 매 손수: 매 virtual list 의 사용.
🧪 검증 / 중복
- Verified (web.dev Avoid Layout Thrashing, Paul Irish gist, Chrome DevRel).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — read/write batch + rAF + ResizeObserver |