Skip to content

⚡ Bolt: Optimize SessionTimelineChart 성능 개선#211

Closed
seonghobae wants to merge 11 commits into
developmentalfrom
bolt/optimize-session-timeline-chart-6683501857205776692
Closed

⚡ Bolt: Optimize SessionTimelineChart 성능 개선#211
seonghobae wants to merge 11 commits into
developmentalfrom
bolt/optimize-session-timeline-chart-6683501857205776692

Conversation

@seonghobae

Copy link
Copy Markdown

💡 What:
packages/web/src/components/dashboard/session-timeline-chart.tsx 파일의 SessionTimelineChart 컴포넌트 내에서 차트 데이터를 생성할 때 발생하는 비효율적인 날짜 파싱 및 계산 로직을 개선했습니다.

  • useMemo를 도입하여 전체 차트 데이터 생성을 메모이제이션했습니다.
  • .map.filter 루프 안에서 매번 호출되던 new Date(timestamp).getTime()을 루프 외부에서 한 번만 수행하여 숫자형으로 파싱하도록 변경했습니다. (ParsedToolCallPoint, ParsedTimelineUsage 인터페이스 추가)
  • React Hook 규칙에 맞게 early return (if (usageTimeline.length === 0))의 위치를 useMemo 호출 이후로 변경했습니다.

🎯 Why:
기존 코드는 렌더링마다, 그리고 차트 데이터의 각 항목마다 $O(N \times M)$ 복잡도로 값비싼 new Date 파싱을 반복해서 수행했습니다. 특히 툴 호출이나 타임라인 이벤트가 많은 세션의 경우 메인 스레드를 크게 블로킹하여 화면 버벅임(UI 렉)을 유발하는 주요 성능 병목이었습니다.

📊 Impact:

  • 컴포넌트 리렌더링 시 발생하는 중복 데이터 계산 비용(Re-renders overhead) 제거
  • 문자열 Date 파싱 횟수를 $O(N \times M)$에서 $O(N + M)$으로 크게 감소시켜 메인 스레드 부하 완화

🔬 Measurement:

  • 여러 개의 도구 호출과 긴 타임라인 이벤트(100+ items)를 포함하는 세션 상세 페이지 로딩/렌더링 시 브라우저 프로파일러(React DevTools) 상의 컴포넌트 렌더링 소요 시간 확인
  • 리렌더링(예: 창 크기 조절 등) 시 SessionTimelineChart 렌더 시간 단축 여부 확인

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

seonghobae and others added 11 commits June 22, 2026 10:26
…licate calculation

`buildTimelineGroups` was calculated redundantly inside both `EventList` and `SessionActivityRibbon` inside `useMemo` hooks. This commit moves the `useMemo` computation into the parent `page.tsx` component and passes down `groups` as a prop to its children, preventing duplicate O(n) array iterations per `events` change.
Replace chained `.reduce()` and `Object.values()` with a single `for...of` loop over `Object.keys()` to avoid unnecessary intermediate array allocations and improve iteration performance during report aggregation.
overview-stats 컴포넌트의 설명 텍스트를 펼치거나 접는 버튼에 키보드 포커스 스타일이 누락되어 있어, 키보드 내비게이션 사용자에게 현재 포커스 위치를 명확히 보여주지 못하는 문제를 수정했습니다.

Tailwind CSS의 `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm` 클래스를 추가하여 탭(Tab) 키 이동 시 포커스 링이 보이도록 접근성을 개선했습니다.
- `TokenUsageChart`와 `WeeklyFlowChart`의 데이터 변환 로직에 `useMemo`를 적용하여 불필요한 리렌더링 최적화.
- Date 파싱 로직을 렌더링 루프 내부에서 `useMemo` 블록 내 사전 파싱 단계로 분리
- 차트 데이터를 메모이제이션하여 불필요한 재계산 방지
- $O(N \times M)$ 문자열 파싱 병목 현상을 $O(N + M)$ 으로 개선
@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