Skip to content

⚡ Bolt: [성능 개선] 이벤트 리스트 렌더링 시 Date 객체 생성 및 파싱 최적화#129

Closed
seonghobae wants to merge 11 commits into
developmentalfrom
bolt-event-list-perf-7397012600858507818
Closed

⚡ Bolt: [성능 개선] 이벤트 리스트 렌더링 시 Date 객체 생성 및 파싱 최적화#129
seonghobae wants to merge 11 commits into
developmentalfrom
bolt-event-list-perf-7397012600858507818

Conversation

@seonghobae

Copy link
Copy Markdown

💡 What (무엇을):
대시보드 세션 이벤트 리스트(EventList) 렌더링 시, sessionStartedAt 날짜 문자열을 파싱하는 로직(new Date().getTime())을 Row 외부로 분리했습니다. EventList 컴포넌트 내부에서 useMemo를 통해 파싱된 number 값(sessionStartedAtMs)을 생성하고 이를 하위 컴포넌트로 전달하도록 변경했습니다.

🎯 Why (왜):
기존 구조에서는 가상화된 리스트(virtualized list)의 각 Row가 렌더링될 때마다 formatElapsed 함수 내에서 new Date(sessionStartedAt).getTime()을 반복적으로 호출하고 있었습니다. 수백~수천 개의 이벤트 항목이 스크롤될 때마다 무의미한 Date 객체가 반복 생성되고 문자열 파싱이 발생하여 메인 스레드를 블로킹하고 가비지 컬렉션 부하를 유발하는 병목 지점이었습니다.

📊 Impact (기대 효과):
각 row 렌더링 시 발생하는 Date 객체 초기화 비용을 제거함으로써 리스트 스크롤 시 불필요한 메모리 할당(Array allocations 및 GC 부하)을 방지하고 프론트엔드의 성능을 개선합니다. 특히 이벤트 개수가 매우 많은 대형 세션 화면에서 UI 버벅거림(jank)이 감소합니다.

🔬 Measurement (어떻게 검증했는지):

  • 가상화된 리스트의 컴포넌트인 EventList, Row의 프로퍼티 타이핑 변경 반영 완료
  • 변경 후 pnpm --filter @argos/web test를 통해 렌더링 관련 유닛 테스트 모두 통과 확인
  • 빌드/린트 스크립트 실행 시 이상 없음 확인

PR created automatically by Jules for task 7397012600858507818 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`를 적용하여 불필요한 리렌더링 최적화.
* Pre-parse sessionStartedAt into a numeric timestamp via useMemo at the component level
* Pass the primitive value to row renderer, avoiding per-item Date object instantiations and parsing
* Reduces memory allocations and improves scrolling performance in virtualized lists
@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.

Copilot AI review requested due to automatic review settings June 27, 2026 20:47

Copilot AI 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.

Pull request overview

This PR reduces per-row overhead in the dashboard session EventList by precomputing the session start timestamp once and passing the parsed milliseconds value down to the virtualized row renderer, avoiding repeated parsing/work during scrolling.

Changes:

  • Refactored formatElapsed to accept a pre-parsed sessionStartedAtMs: number instead of a start-time string.
  • Added a memoized sessionStartedAtMs computation in EventList and threaded it through RowProps into Row.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +275 to +278
const sessionStartedAtMs = useMemo(
() => new Date(sessionStartedAt).getTime(),
[sessionStartedAt]
);
@seonghobae

Copy link
Copy Markdown
Author

Closing as superseded during org-wide PR triage. Keeping #211 as the canonical PR for the same overlapping topic: event list/session timeline date parsing optimization. This PR is stale/conflicted or has review blockers, so retaining one current PR reduces duplicated review and merge conflict work.

@seonghobae seonghobae closed this Jul 7, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing as superseded during org-wide PR triage. Keeping #211 as the canonical PR for the same overlapping topic: event list/session timeline date parsing optimization. This PR is stale/conflicted or has review blockers, so retaining one current PR reduces duplicated review and merge conflict work.

Understood. Acknowledging that this work is now obsolete and stopping work on 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.

2 participants