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 폴더 제거.
4.7 KiB
4.7 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-diffing-algorithm | Diffing Algorithm | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Diffing Algorithm
매 한 줄
"매 VDOM diff = O(n) heuristic — 매 same-level node 의 비교 + key-based identity.". 매 React/Vue/Preact 모두 매 Levenshtein-style O(n³) 의 회피하기 위해 매 두 가정 (1) 다른 type = subtree 교체, (2) key가 child identity 의 hint. 매 React 19 (2024) Fiber + concurrent rendering, Vue 3.4 patchFlag-driven static hoist 의 진화.
매 핵심
매 두 가정 (Heuristics)
- 매 different element type ⇒ subtree 의 unmount + 재생성.
- 매 stable
key⇒ list reconciliation 의 identity hint.
매 알고리즘
- React = Fiber tree, work loop가 매 cooperative scheduling 가능 (concurrent mode).
- Vue 3 = compiled patchFlag (static / dynamic 분류) + LIS (Longest Increasing Subsequence) for keyed list.
- Svelte/Solid = 매 VDOM 없음 — 매 fine-grained reactivity 의 directly DOM 의 patch.
매 응용
- Keyed list — 매 stable key가 매 reorder cost 의 minimize.
- Conditional render — 매 ternary가 매 type swap 의 발생.
- Concurrent rendering — 매 high-priority update가 매 low-priority interrupt.
💻 패턴
1. Stable key (correct)
// CORRECT — id is stable identity
items.map((item) => <Row key={item.id} item={item} />)
// WRONG — index changes when list reorders
items.map((item, i) => <Row key={i} item={item} />)
2. Type swap forces unmount
{condition ? <div>A</div> : <span>A</span>}
// span/div type 다름 → subtree unmount + remount
// 같은 component reuse 원하면 같은 type 유지:
<div>{condition ? 'A' : 'B'}</div>
3. React Fiber priority lanes (19)
import { useTransition } from 'react';
const [isPending, startTransition] = useTransition();
const onChange = (e) => {
setInput(e.target.value); // urgent
startTransition(() => {
setFilter(e.target.value); // can be interrupted
});
};
4. Vue 3 patchFlag (compiled)
<!-- Source -->
<div>
<span>{{ msg }}</span>
<span class="static">hi</span>
</div>
<!-- Compiled (simplified) -->
<!-- 첫 span has patchFlag = 1 (TEXT) → diff only text -->
<!-- 두번째 span hoisted as static — 매 diff 건너뛰기 -->
5. Vue keyed list w/ LIS
<TransitionGroup tag="ul">
<li v-for="item in items" :key="item.id">{{ item.label }}</li>
</TransitionGroup>
<!-- Vue calculates LIS to minimize DOM moves -->
6. React.memo + structural equality
const Row = React.memo(({ item }: { item: Item }) =>
<div>{item.label}</div>,
(prev, next) => prev.item.id === next.item.id && prev.item.label === next.item.label,
);
7. Solid/Svelte alternative (no diff)
// Solid — fine-grained reactivity, no VDOM
import { createSignal } from 'solid-js';
const [count, setCount] = createSignal(0);
// JSX compiles to direct DOM ops; only `count()` text node updates
return <div>count: {count()}</div>;
8. Avoid layout-impacting reorder
// Stable order with key — only reorder DOM, no remount
<>{sorted.map((u) => <UserCard key={u.id} user={u} />)}</>
// Each UserCard preserves its instance (state, refs) on reorder.
매 결정 기준
| 상황 | Approach |
|---|---|
| List render | 매 stable id key — index X. |
| Heavy filter + input | useTransition + deferredValue. |
| Static UI | Vue patchFlag / React.memo. |
| Maximum perf | Solid / Svelte (skip VDOM). |
| Type-switch UI | wrap in same outer type to preserve children. |
기본값: 매 React 19 + Suspense + Transition + 매 stable key.
🔗 Graph
- 부모: Virtual DOM과 Reconciliation · Reconciliation
- 변형: React Fiber · Vue Reactivity
- 응용: Animation
🤖 LLM 활용
언제: 매 keyed-list bug 의 explain, 매 type-swap unmount 의 진단. 언제 X: 매 specific framework internal — 매 source code 의 read.
❌ 안티패턴
- Index as key with reorder: 매 wrong identity → state mix.
- Random key per render: 매 매 unmount + remount.
- Inline objects/arrays as deps: 매 referential change → memo bypass.
- Massive un-keyed list: 매 O(n) DOM ops 매 frame.
🧪 검증 / 중복
- Verified (react.dev reconciliation, vuejs.org renderer, Solid docs).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — VDOM diff + Fiber + Vue patchFlag |