Skip to content

⚡ Bolt: [성능 개선] ERD 노드 검색 시 문자열 병합 및 WeakMap 캐싱을 통한 최적화 - #987

Open
seonghobae wants to merge 1 commit into
mainfrom
bolt-search-performance-16378959818387102560
Open

⚡ Bolt: [성능 개선] ERD 노드 검색 시 문자열 병합 및 WeakMap 캐싱을 통한 최적화#987
seonghobae wants to merge 1 commit into
mainfrom
bolt-search-performance-16378959818387102560

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

💡 What: ERD 검색 시 노드의 모든 문자열 필드를 하나로 합쳐 WeakMap에 캐싱하도록 검색 로직을 수정했습니다.
🎯 Why: 기존 방식은 타이핑 시마다 노드의 모든 컬럼 문자열을 매번 .toLocaleLowerCase()로 변환하여 과도한 객체 할당과 GC 부하를 유발했습니다.
📊 Impact: 타이핑 시마다 발생하는 문자열 할당을 O(C)에서 O(1)로 대폭 감소시키고, C++ 수준의 단일 문자열 .includes()로 검색 속도를 향상시킵니다.
🔬 Measurement: 수백 개의 테이블과 컬럼이 있는 대규모 ERD에서 타이핑 시 발생하는 프레임 드랍이 현저히 감소하고 반응성이 개선됩니다.


PR created automatically by Jules for task 16378959818387102560 started by @seonghobae


Open in Devin Review

💡 What: ERD 검색 시 노드의 모든 문자열 필드를 하나로 합쳐 `WeakMap`에 캐싱하도록 검색 로직을 수정했습니다.
🎯 Why: 기존 방식은 타이핑 시마다 노드의 모든 컬럼 문자열을 매번 `.toLocaleLowerCase()`로 변환하여 과도한 객체 할당과 GC 부하를 유발했습니다.
📊 Impact: 타이핑 시마다 발생하는 문자열 할당을 O(C)에서 O(1)로 대폭 감소시키고, C++ 수준의 단일 문자열 `.includes()`로 검색 속도를 향상시킵니다.
🔬 Measurement: 수백 개의 테이블과 컬럼이 있는 대규모 ERD에서 타이핑 시 발생하는 프레임 드랍이 현저히 감소하고 반응성이 개선됩니다.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 49 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1231039c-a322-4244-8ca9-5de0fda93d91

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc7469 and e1256b9.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • frontend/src/erd/search.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

Comment on lines 33 to +38
new Set(search.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)),
);
if (terms.length === 0) return false;
return terms.every((term) => nodeIncludesTerm(node, term));

const nodeText = getNodeSearchText(node);
return terms.every((term) => nodeText.includes(term));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Combined-haystack search matches per-field results

Search now joins all node fields with a space and calls .includes instead of testing fields individually. Since terms are split on \s+ and the join separator is a space, no term can span a field boundary, so results stay identical to the old per-field logic.

(Refers to this code)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +5 to 24
const nodeSearchTextCache = new WeakMap<TableNodeData, string>();

function getNodeSearchText(node: Node<TableNodeData>): string {
let text = nodeSearchTextCache.get(node.data);
if (text !== undefined) return text;

function nodeIncludesTerm(node: Node<TableNodeData>, term: string): boolean {
if (fieldIncludes(node.data.title, term)) return true;
if (fieldIncludes(node.data.comment, term)) return true;
const parts: string[] = [];
if (node.data.title) parts.push(node.data.title);
if (node.data.comment) parts.push(node.data.comment);

for (const column of node.data.columns) {
if (fieldIncludes(column.column_name, term)) return true;
if (fieldIncludes(column.data_type, term)) return true;
if (fieldIncludes(column.column_comment, term)) return true;
for (const col of node.data.columns) {
if (col.column_name) parts.push(col.column_name);
if (col.data_type) parts.push(col.data_type);
if (col.column_comment) parts.push(col.column_comment);
}

return false;
text = parts.join(" ").toLocaleLowerCase();
nodeSearchTextCache.set(node.data, text);
return text;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Search-text cache cannot go stale

nodeSearchTextCache is keyed on node.data. Every content edit in App.tsx builds a new data object via ...node.data spread, so the key changes whenever searchable text changes. Drag updates keep the same reference, yielding a correct cache hit.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant