[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,122 +1,230 @@
|
||||
---
|
||||
id: wiki-2026-0508-fragment-bound
|
||||
title: Fragment bound
|
||||
title: Fragment-bound
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [React Fragment, Fragment-bound Component, Multi-root Component]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [auto-consolidated, technical-documentation]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [react, frontend, jsx, dom]
|
||||
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: typescript
|
||||
framework: react
|
||||
---
|
||||
|
||||
# [[Fragment-bound|Fragment-bound]]
|
||||
# Fragment-bound
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> 'Fragment-bound(프래그먼트 바운드)'는 3D 그래픽스 렌더링 파이프라인에서 GPU의 프래그먼트 셰이딩(픽셀 처리) 용량이 한계에 도달하여 전체 시스템의 성능 병목이 되는 상태를 의미합니다 [1, 2]. 이 상태는 주로 객체들이 카메라 기준 깊이(Depth)에 따라 정렬되지 않은 채 렌더링될 때, 동일한 픽셀에 여러 번 그리기 연산이 수행되는 '오버드로우([[Overdraw|Overdraw]])' 현상으로 인해 촉발됩니다 [1, 2]. 특히 연산 비용이 높은 재질을 사용할 때 이 병목 현상은 더욱 극심해집니다 [2, 3].
|
||||
## 매 한 줄
|
||||
> **"매 component 의 root 의 wrapper div 의 elimination"**. React Fragment (`<>...</>` 또는 `<Fragment>`) 매 component 매 multiple sibling roots 의 return 의 enable — 매 unnecessary `<div>` wrapper 의 avoid. "Fragment-bound" component 매 single DOM root 의 not-have, 매 layout (Grid, Table, Flex) 매 fragile 의 implication 의 carry.
|
||||
|
||||
---
|
||||
## 매 핵심
|
||||
|
||||
> 프래그먼트 바운드(Fragment-bound)는 3D 렌더링 파이프라인에서 GPU의 프래그먼트(픽셀) 연산 부하가 극심해져 전체 렌더링 성능과 프레임 레이트(FPS)를 제한하는 병목 상태를 의미합니다. 주로 화면에 그려지는 객체들이 렌더링 순서대로 정렬되지 않아 동일한 픽셀 위치에 렌더링 계산이 여러 번 중첩되는 오버드로우([[Overdraw|Overdraw]]) 현상으로 인해 발생합니다. 무거운 조명 연산이 포함된 재질을 사용할 때 이 상태에 더욱 쉽게 빠지게 됩니다 [1, 2].
|
||||
### 매 Why Fragment
|
||||
- **DOM cleanliness**: 매 wrapper div 의 CSS Grid/Flex 의 break — 매 child 매 grid item 의 directly 의 must be.
|
||||
- **No semantic noise**: 매 `<table>` 매 `<tr>` 매 `<td>` 의 nest 의 wrapper div 의 invalid HTML.
|
||||
- **Performance (marginal)**: 매 fewer DOM nodes — 매 hot lists 의 measurable.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **오버드로우(Overdraw)에 의한 연산 과부하:**
|
||||
프래그먼트 바운드 상태는 화면의 동일한 픽셀 영역에 대해 셰이더 연산과 쓰기 작업이 여러 번 중첩되어 발생하는 오버드로우에 의해 야기됩니다 [1, 2]. GPU가 최종 화면에 보이지 않고 가려질 픽셀까지 모두 계산하게 되면서 픽셀 처리 성능을 상회하는 부하가 발생합니다 [2].
|
||||
- **[[InstancedMesh|InstancedMesh]]의 정렬 부재와 병목:**
|
||||
Three.js의 `InstancedMesh`는 단일 드로우 콜로 렌더링을 수행하지만 개별 인스턴스들의 렌더링 순서를 자동으로 정렬([[Sorting|Sorting]])하지 않습니다 [1, 2]. 만약 카메라와 가장 멀리 있는 인스턴스가 먼저 그려지고 가까운 인스턴스가 나중에 그려진다면 막대한 오버드로우 비용이 발생하게 되며, 이로 인해 씬(Scene)이 프래그먼트 바운드 상태에 빠지게 됩니다 [2].
|
||||
- **재질(Material) 복잡도의 영향과 해결책:**
|
||||
복잡한 조명 및 그림자 연산이 포함된 `MeshStandardMaterial`과 같은 셰이더를 사용할 경우 프래그먼트 바운드 현상은 훨씬 더 심화됩니다 [2, 3]. 이 문제를 완화하기 위해서는 오버드로우의 비용 자체를 줄일 수 있는 단순한 `MeshBasicMaterial`을 사용하여 비교하거나 [3], 자동으로 인스턴스 정렬을 지원하는 `BatchedMesh`로 전환하여 렌더링 효율을 높이는 것이 대안으로 제시됩니다 [1].
|
||||
### 매 Forms
|
||||
- `<></>` — short syntax, 매 no key/props.
|
||||
- `<Fragment key={...}>` — 매 list iteration 매 key 의 needed 시.
|
||||
- `<React.Fragment>` — explicit import, 매 build tooling 의 short syntax 의 not-support 시.
|
||||
|
||||
---
|
||||
### 매 Fragment-bound implications
|
||||
- 매 ref 의 attach 의 not-possible (매 single DOM node 의 not-have).
|
||||
- 매 parent 매 child layout 의 control 의 must — 매 child 매 own root 의 not-have.
|
||||
- 매 portals 매 separate concern.
|
||||
|
||||
- **발생 원인과 오버드로우(Overdraw):** 프래그먼트 바운드 상태는 렌더링 파이프라인의 후반부인 프래그먼트 셰이딩([[Fragment Shading|Fragment Shading]]) 단계의 과부하로 발생합니다. 주된 원인은 오버드로우로, 불투명한 물체를 '앞에서 뒤로(Front-to-Back)' 정렬하지 않고 렌더링하여 뒤에 가려질 픽셀에 대해서도 GPU가 불필요한 계산을 중복해서 수행할 때 일어납니다 [2].
|
||||
- **[[InstancedMesh|InstancedMesh]]의 구조적 한계:** `InstancedMesh` 기술은 드로우 콜([[Draw Call|Draw Call]])을 줄여 CPU 오버헤드를 낮추는 데 효과적이지만, 인스턴스들에 대한 자동 정렬 기능을 제공하지 않습니다 [1, 2]. 따라서 카메라에서 멀리 있는 인스턴스가 먼저 그려지고 가까운 인스턴스가 나중에 그려지는 배치가 발생하면, 오버드로우 비용이 GPU의 픽셀 처리 성능을 상회하게 되어 프래그먼트 바운드 상태를 유발합니다 [2].
|
||||
- **재질(Material) 복잡도의 영향:** 오버드로우로 인한 프래그먼트 바운드 현상은 복잡한 조명 연산이 포함된 `MeshStandardMaterial`과 같은 무거운 재질을 사용할 때 그 심각성이 극대화됩니다 [1, 2].
|
||||
- **성능 개선 대안:** 프래그먼트 바운드 병목을 해결하기 위한 대안 중 하나로 `BatchedMesh`를 사용할 수 있습니다. `InstancedMesh`와 달리 `BatchedMesh`는 인스턴스들의 정렬(sorted)을 지원하므로 오버드로우를 효과적으로 줄일 수 있습니다 [1].
|
||||
### 매 응용
|
||||
1. Table rows / cells (`<TableRow>` returning `<td>...</td><td>...</td>`).
|
||||
2. Grid items in CSS Grid layout.
|
||||
3. Component library — wrapper-less primitives.
|
||||
4. Conditional sibling rendering.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** Graphics & Performance 분야의 자동 자산화 수행.
|
||||
## 💻 패턴
|
||||
|
||||
---
|
||||
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** Graphics & Performance 분야의 자동 자산화 수행.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** [[Overdraw|Overdraw]], [[InstancedMesh|InstancedMesh]], MeshStandardMaterial, BatchedMesh
|
||||
- **Projects/Contexts:** Three.js 렌더링 성능 최적화
|
||||
- **Contradictions/Notes:** 드로우 콜을 줄여 성능을 향상시키기 위해 고안된 `InstancedMesh`가, 정렬 기능의 부재로 인해 오히려 심각한 오버드로우와 프래그먼트 바운드를 유발하여 일반 `Mesh`를 여러 번 그릴 때보다 프레임 레이트(FPS)를 더 하락시킬 수 있다는 점이 주의사항으로 보고됩니다 [2, 4].
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-19*
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
- **Related Topics:** [[오버드로우(Overdraw)|오버드로우(Overdraw]], InstancedMesh, BatchedMesh, [[프래그먼트 셰이딩(Fragment Shading)|프래그먼트 셰이딩(Fragment Shading]]
|
||||
- **Projects/Contexts:** Three.js 렌더링 성능 최적화, [[MeshStandardMaterial 조명 연산|MeshStandardMaterial 조명 연산]]
|
||||
- **Contradictions/Notes:** 소스에 따르면 `InstancedMesh`는 CPU의 드로우 콜 병목을 해소하기 위해 도입되지만, 내부 정렬([[Sorting|Sorting]])의 부재로 인해 오히려 GPU 측에서 프래그먼트 바운드라는 새로운 형태의 성능 병목을 유발할 수 있는 구조적 트레이드오프를 지니고 있습니다 [1, 2].
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-19*
|
||||
|
||||
---
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
### Basic Fragment
|
||||
```tsx
|
||||
function Greeting() {
|
||||
return (
|
||||
<>
|
||||
<h1>Hello</h1>
|
||||
<p>World</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
// 매 DOM 의 <h1>+<p> 의 sibling, 매 no wrapper
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Fragment with key (list)
|
||||
```tsx
|
||||
import { Fragment } from 'react';
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
function Glossary({ items }: { items: { term: string; def: string }[] }) {
|
||||
return (
|
||||
<dl>
|
||||
{items.map(it => (
|
||||
<Fragment key={it.term}>
|
||||
<dt>{it.term}</dt>
|
||||
<dd>{it.def}</dd>
|
||||
</Fragment>
|
||||
))}
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
// 매 short syntax 매 key prop 의 not-accept — 매 explicit Fragment 의 use
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Table row composition
|
||||
```tsx
|
||||
function ProductRow({ product }: { product: Product }) {
|
||||
return (
|
||||
<>
|
||||
<td>{product.name}</td>
|
||||
<td>{product.price}</td>
|
||||
<td>{product.stock}</td>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
function ProductTable({ products }: { products: Product[] }) {
|
||||
return (
|
||||
<table>
|
||||
<tbody>
|
||||
{products.map(p => (
|
||||
<tr key={p.id}><ProductRow product={p} /></tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
// 매 wrapper div 매 tr 안 의 invalid HTML — 매 Fragment 의 only correct
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### CSS Grid items
|
||||
```tsx
|
||||
function GridGroup() {
|
||||
return (
|
||||
<>
|
||||
<div className="grid-item">A</div>
|
||||
<div className="grid-item">B</div>
|
||||
<div className="grid-item">C</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
function Layout() {
|
||||
return (
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)' }}>
|
||||
<GridGroup /> {/* 매 3 children 의 grid items 의 directly */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// 매 wrapper div 의 add 시 매 single grid cell 의 collapse
|
||||
```
|
||||
|
||||
### Conditional sibling rendering
|
||||
```tsx
|
||||
function Notification({ user }: { user?: User }) {
|
||||
if (!user) return null;
|
||||
return (
|
||||
<>
|
||||
{user.unreadCount > 0 && (
|
||||
<span className="badge">{user.unreadCount}</span>
|
||||
)}
|
||||
<span className="name">{user.name}</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Ref forwarding 매 NOT possible
|
||||
```tsx
|
||||
// 매 X — Fragment 매 ref 의 not-attach 의
|
||||
const Bad = forwardRef<HTMLDivElement>((props, ref) => (
|
||||
<>
|
||||
<h1 ref={ref}>Title</h1> {/* 매 child element 의 ref 의 forward 의 must */}
|
||||
<p>Body</p>
|
||||
</>
|
||||
));
|
||||
|
||||
// 매 O — 매 explicit child 의 ref 의 forward
|
||||
const Card = forwardRef<HTMLHeadingElement, { title: string; body: string }>(
|
||||
({ title, body }, ref) => (
|
||||
<>
|
||||
<h1 ref={ref}>{title}</h1>
|
||||
<p>{body}</p>
|
||||
</>
|
||||
),
|
||||
);
|
||||
```
|
||||
|
||||
### Suspense / ErrorBoundary 매 Fragment children
|
||||
```tsx
|
||||
function App() {
|
||||
return (
|
||||
<Suspense fallback={<Spinner />}>
|
||||
<>
|
||||
<Header />
|
||||
<Main />
|
||||
<Footer />
|
||||
</>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
// 매 Suspense 매 single child 의 not-require — 매 Fragment 의 N children 의 all 의 wait
|
||||
```
|
||||
|
||||
### Slot pattern 의 fragment-aware
|
||||
```tsx
|
||||
type SlotProps = { children: ReactNode };
|
||||
function Slot({ children }: SlotProps) {
|
||||
// 매 children 매 Fragment 매 single 매 multiple 매 unwrap 의 logic
|
||||
if (isValidElement(children) && children.type === Fragment) {
|
||||
return <>{children.props.children}</>;
|
||||
}
|
||||
return <>{children}</>;
|
||||
}
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Component 매 단일 root 의 natural | 매 `<div>` 의 use |
|
||||
| Wrapper div 매 layout 의 break | 매 Fragment |
|
||||
| Table / dl / select children | 매 Fragment 의 mandatory |
|
||||
| List item with multiple roots | 매 Fragment with key |
|
||||
| Ref / styling 의 root needed | 매 div / specific element 의 use |
|
||||
|
||||
**기본값**: 매 wrapper 매 semantic value 의 carry 의 div, 매 그렇지 않으면 매 Fragment.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[React]] · [[JSX]]
|
||||
- 변형: [[React-Portal]] · [[Slot-Pattern]]
|
||||
- 응용: [[CSS-Grid]] · [[HTML-Tables]] · [[Component-Composition]]
|
||||
- Adjacent: [[Ref-Forwarding]] · [[ReactDOM-render]] · [[ChildrenAPI]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 multi-root component. Table/Grid layout 의 wrapper 의 break 의 시. List item 매 multiple sibling 의 render.
|
||||
**언제 X**: 매 single root + ref/styling needed — 매 div 의 use. Wrapper 의 styling target 의 expected 시.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Wrapper div habit**: 매 모든 component 매 `<div>` 의 wrap — 매 div soup, 매 layout 의 fragile.
|
||||
- **Fragment without key in list**: 매 `<>` 매 `.map` 안 의 use — 매 React warning + reconciliation 의 broken.
|
||||
- **Trying to ref a Fragment**: 매 Fragment 의 DOM node 의 not-have — 매 forwardRef 의 specific child 의 forward 의 must.
|
||||
- **Fragment inside single-child API**: 매 some libs (older) 매 single child 의 expect — 매 Fragment 의 expand, 매 break.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (React docs "Fragments"; React 16.2 release notes).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Fragment patterns + table/grid/key examples |
|
||||
|
||||
Reference in New Issue
Block a user