Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ Optimized metric route processing to O(N) by creating a mapping of routes direct
## 2026-06-25 - Avoid Map allocations in frontend ERD loops and mutate asyncpg records in-place
**Learning:** The frontend `snapshotToGraph` iterates over thousands of columns to generate the graph, so repeated lookups and redundant collection assignments increase GC pressure. Backend snapshot column dictionaries are freshly instantiated for the payload, so `add_column_examples` can safely fill missing fields in place.
**Action:** Reuse existing collections while aggregating relational data, create `Map`/`Set` entries only on first use, and check for missing example fields before calling expensive inference helpers.
## 2024-07-02 - Avoid massive array spreads and allocations in search loops
**Learning:** Using `.flatMap(...)` with array spreading (`...`) and `.join(" ")` on all node properties during every keystroke of a search bar creates massive intermediate strings and arrays. This non-short-circuiting approach causes significant garbage collection overhead, leading to severe input lag for large ERDs.
**Action:** Replace high-level array manipulation in hot search loops with explicit `for` loops that use early `break` or `continue` to short-circuit upon finding a match, preventing unnecessary allocations and string building.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
- 새롭게 추가된 UI 플로우를 위한 기본 테스트 코드(`App.editTable.test.tsx`, `TableNode.test.tsx`) 추가 및 Vitest 프레임워크 셋업 보완.

### 🐛 개선 (Improvements)
- 대규모 ERD 검색 성능 개선: `flatMap`, 배열 복사(`...`), 그리고 긴 문자열 조인(`join(" ")`)을 제거하고 `for` 루프와 `break`/`continue`를 활용하여 조건 성립 즉시 평가를 중단(short-circuit)하도록 개선함으로써 사용자 입력 지연(Input Lag)과 불필요한 메모리 할당(Garbage Collection 압박)을 해결.
- 불필요한 백엔드 포맷팅 이슈(`ruff` 포맷) 해결.
- 테스트 커버리지를 높이기 위해 기본 단위 테스트 환경(jsdom, @testing-library) 구축 및 활용.
34 changes: 22 additions & 12 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,28 @@ export default function App() {
if (!normalizedNodeSearch) return new Set<string>();
const matches = new Set<string>();
for (const node of nodes) {
const haystack = [
node.data.title,
node.data.comment ?? "",
...node.data.columns.flatMap((column) => [
column.column_name,
column.data_type,
column.column_comment ?? "",
]),
]
.join(" ")
.toLocaleLowerCase();
if (haystack.includes(normalizedNodeSearch)) {
if (node.data.title.toLocaleLowerCase().includes(normalizedNodeSearch)) {
matches.add(node.id);
continue;
}
if (node.data.comment?.toLocaleLowerCase().includes(normalizedNodeSearch)) {
Comment on lines +185 to +189
matches.add(node.id);
continue;
}

let matched = false;
for (const column of node.data.columns) {
if (
column.column_name.toLocaleLowerCase().includes(normalizedNodeSearch) ||
column.data_type.toLocaleLowerCase().includes(normalizedNodeSearch) ||
column.column_comment?.toLocaleLowerCase().includes(normalizedNodeSearch)
) {
matched = true;
break;
}
}

if (matched) {
matches.add(node.id);
}
}
Expand Down