⚡ Bolt: Optimize edge column lookup via direct handle decoding - #670
⚡ Bolt: Optimize edge column lookup via direct handle decoding#670seonghobae wants to merge 1 commit into
Conversation
DDL 생성을 위해 간선(edge) 데이터를 반복 처리할 때(`fkColumnsForEdge`), 매번 전체 컬럼 목록을 순회하며 핸들 ID 인코딩(`sourceColumnHandleId`)을 반복 실행하는 O(N) 연산과 불필요한 메모리 할당(문자열 분리 등)이 발생했습니다. 이를 O(1) 핸들 디코딩 함수(`decodeSourceHandleId`, `decodeTargetHandleId`)로 직접 추출한 후, `.some()`을 사용해 확인하는 방식으로 변경하여 수출(Export) 로직의 성능 낭비를 개선했습니다. 관련된 테스트 케이스도 작성하였으며, 테스트 커버리지를 100%로 유지했습니다.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
💡 What:
frontend/src/erd/handleUtils.ts에decodeSourceHandleId와decodeTargetHandleId함수를 추가하고,frontend/src/erd/export.ts의fkColumnsForEdge로직에서 이를 활용하도록 리팩토링했습니다. 기존 방식은 O(N)으로 전체 열을 순회하며 매번 hex 인코딩을 수행했지만, 새 방식은 O(1)로 엣지 핸들을 한 번만 디코딩하여 매칭합니다.🎯 Why:
내보내기 작업 시(특히 거대한 스키마에서 DDL, SVG 등 생성) 엣지와 관련된 컬럼 정보를 확인하기 위해, 엣지의 핸들 ID와 각 노드의 모든 컬럼 이름을 다시 hex 인코딩(내부적으로
Array.from과 배열 join 연산 사용)하여 비교하는 구조가 있었습니다. 이는 불필요한 CPU 사이클과 대규모 가비지 컬렉션을 유발했습니다.📊 Impact:
모든 간선에서 노드의 컬럼 갯수에 비례해 반복되던 인코딩 연산(O(N))을 한 번의 디코딩 연산(O(1))으로 축소시켜, 복잡한 ERD 다이어그램에 대한 내보내기 성능을 크게 향상시키고 메모리 압박(GC 호출)을 줄입니다.
🔬 Measurement:
cd frontend && pnpm run test --coverage를 실행하여 새 디코딩 함수와 내보내기 로직이 올바르게 동작하는 것을 확인했으며(이전과 동일한 기능 유지), 모든 테스트를 통과하고 V8 커버리지 100%를 달성합니다.PR created automatically by Jules for task 16458206108479906965 started by @seonghobae