⚡ Bolt: [성능 개선] SessionTimelineChart 데이터 집계 최적화 (O(N*M) -> O(N+M)) - #327
Conversation
|
👋 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: 2 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 (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
SessionTimelineChart에서 툴 호출(tool call) 이벤트를 usage timeline 구간에 매핑해 차트용 데이터를 생성하는 로직을, 중첩 필터 기반의 O(N*M) 방식에서 정렬 + 투 포인터 기반의 O(N+M) 방식으로 바꿔 긴 세션에서 렌더링/메인스레드 블로킹을 줄이려는 PR입니다.
Changes:
- 툴 호출 요약 문자열 생성 로직을
Map/Array.from대신 POJO 카운팅 +Object.keys()기반으로 변경 messages에서toolCalls를 추출한 뒤 timestamp 기준 정렬을 추가usageTimeline과toolCalls를 시간순으로 전진 스캔(two-pointer)하여 구간별 툴 이벤트를 수집해chartData생성
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return count > 1 ? `${name} x${count}` : name | ||
| }) | ||
| const displayCount = Math.min(3, keys.length) | ||
| const displayItems = [] |
| const sortedUsage = [...usageTimeline].sort( | ||
| (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime() | ||
| ) |
💡 What
SessionTimelineChart컴포넌트 내에서 차트 데이터를 생성할 때 사용되던.filter()반복 루프 로직을 제거하고, 시간순 정렬 기반의 두 포인터(Two-Pointer) 알고리즘을 도입하여🎯 Why
기존 로직은
usageTimeline의 각 항목(N개)마다 전체toolCalls배열(M개)을.filter()로 전체 순회하며 매칭 여부를 검사했습니다. 이는 데이터 양이 많거나 긴 세션 로그를 렌더링할 때 React의 메인 스레드를 심각하게 블로킹하고 Recharts 컴포넌트의 렌더링 지연시간(Lag)을 초래하는 핵심 성능 병목이었습니다.📊 Impact
Map및Array.from()의 반복 생성 대신 POJO({}) 와Object.keys()를 활용하여 가비지 컬렉션(GC) 오버헤드와 배열 할당 비용을 절감했습니다.🔬 Measurement
usageTimeline및messages데이터를 SessionTimelineChart에 주입하여 브라우저의 성능 탭(Performance Profiler) 상 JS 실행 시간 비교 (Scripting time 감소 확인).session-timeline-chart.test.tsx)가 100% Coverage로 정상 통과하는지 확인하여 논리의 무결성 보장. (완료)PR created automatically by Jules for task 9794960652254018563 started by @seonghobae