Skip to content

⚡ Bolt: [performance improvement] Optimize SessionTimelineChart tool rendering complexity#276

Open
seonghobae wants to merge 1 commit into
developmentalfrom
bolt-optimize-timeline-chart-2327614962837510269
Open

⚡ Bolt: [performance improvement] Optimize SessionTimelineChart tool rendering complexity#276
seonghobae wants to merge 1 commit into
developmentalfrom
bolt-optimize-timeline-chart-2327614962837510269

Conversation

@seonghobae

Copy link
Copy Markdown

💡 What

SessionTimelineChart 컴포넌트 내의 toolCalls 데이터를 usageTimeline 버킷에 매핑하는 알고리즘을 O(N*M)의 중첩 루프(nested filter)에서, 타임스탬프 기반 정렬을 활용한 O(N+M) 투 포인터(two-pointer) 접근 방식으로 최적화했습니다.

🎯 Why

기존의 방식은 각 usageTimeline 항목마다 전체 toolCalls 배열을 반복 탐색하는 비효율적인 필터링(Array.prototype.filter)을 사용했습니다. 이는 도구 호출이 많거나 타임라인이 긴 대규모 세션을 렌더링할 때 심각한 병목 현상을 초래하여 메인 스레드를 블로킹하고 UI 렌더링을 지연시켰습니다.

📊 Impact

  • Time Complexity: O(N*M)에서 배열 정렬 오버헤드를 포함하더라도 O(N log N + M log M) + O(N+M) 수준으로 최적화되어, 대규모 배열 환경에서 탐색 오버헤드가 극적으로 감소합니다.
  • 성능 향상: 대규모 세션 데이터 렌더링 시 React 컴포넌트 렌더링 오버헤드가 획기적으로 줄어들며, 불필요한 배열 생성이 방지됩니다.

🔬 Measurement

pnpm --filter @argos/web run test src/components/dashboard/session-timeline-chart.test.tsx 를 실행하여 로직이 손상되지 않았음을 검증했습니다. 큰 세션 데이터로 대시보드를 로딩할 때 렌더링 병목 현상이 완화되었음을 확인할 수 있습니다.


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

Replaced the nested `Array.filter` O(N*M) loop inside the
usageTimeline mapping with an O(N+M) two-pointer algorithm. This
eliminates redundant traversals and significantly speeds up rendering
for sessions with large amounts of tools and usage events.
@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.

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