Skip to content

perf(web): parse timestamp primitives without Date allocation - #428

Merged
seonghobae merged 4 commits into
developmentalfrom
bolt-performance-date-parse-3456526884730841367
Aug 12, 2026
Merged

perf(web): parse timestamp primitives without Date allocation#428
seonghobae merged 4 commits into
developmentalfrom
bolt-performance-date-parse-3456526884730841367

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 11, 2026

Copy link
Copy Markdown

What

Replace repeated new Date(value).getTime() calls with Date.parse(value) where the code needs only a timestamp primitive.

Why

Both forms use the same ECMAScript string-parsing semantics at these call sites. Date.parse avoids constructing a short-lived Date object in chart sorting/mapping and duration formatting paths.

Scope and evidence

  • Bounded allocation micro-optimization; no throughput multiplier is claimed without a committed benchmark.
  • Existing CI, security, dependency, OSV, and SAST workflows passed on the predecessor source head.
  • Fresh exact-head workflows must pass after the documentation correction before merge.

Original Jules task: 3456526884730841367.

Summary by CodeRabbit

  • 개선 사항
    • 세션 타임라인과 사용량 정보에서 타임스탬프를 더 간결하게 처리하도록 개선했습니다.
    • 최근 사용 시간과 기간 표시, 사용량 정렬 및 도구 메시지 처리의 동작은 기존과 동일하게 유지됩니다.
    • 관련 날짜 처리 지침을 문서화했습니다.

V8 엔진 환경에서 반복문 및 잦은 연산 내 `new Date(string).getTime()` 호출 시
불필요한 메모리 할당 및 가비지 컬렉션(GC) 부하가 발생합니다.

이를 `Date.parse(string)`로 대체하여 객체 생성 없이 타임스탬프를 획득하도록 개선했습니다.
이로써 차트 렌더링 및 포맷팅 시 메모리 사용량과 연산 속도가 소폭 향상됩니다.
@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.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

대시보드와 날짜 포맷 유틸리티에서 new Date(...).getTime() 기반 타임스탬프 파싱을 Date.parse(...)로 변경했습니다. 관련 학습 내용과 적용 지침도 추가했습니다.

Changes

타임스탬프 파싱 변경

Layer / File(s) Summary
대시보드 타임스탬프 처리
packages/web/src/components/dashboard/session-timeline-chart.tsx, .jules/bolt.md
사용량 정렬, 현재 사용량 시점 계산, TOOL 메시지 파싱에 Date.parse(...)를 적용했습니다. 원시 타임스탬프가 필요한 경로의 적용 지침을 추가했습니다.
날짜 포맷 타임스탬프 처리
packages/web/src/lib/format.ts
formatLastUsedformatDuration의 날짜 파싱에 Date.parse(...)를 적용했습니다. 종료 시각이 없으면 현재 시각을 사용합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 웹에서 Date 객체 할당 없이 타임스탬프 원시값을 파싱하는 주요 성능 변경을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-performance-date-parse-3456526884730841367

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae changed the title ⚡ Bolt: [성능 개선] Date 객체 생성 오버헤드 제거 (Date.parse 적용) perf(web): parse timestamp primitives without Date allocation Aug 12, 2026

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
packages/web/src/components/dashboard/session-timeline-chart.tsx (1)

70-81: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

정렬 전에 timestamp를 한 번만 파싱하세요.

현재 comparator는 정렬 비교마다 Date.parse를 호출합니다. 동일한 usage.timestampO(n log n)번 파싱될 수 있습니다. 정렬 후 Line 81에서도 다시 파싱합니다. 큰 배열 성능을 목표로 한다면 파싱 결과와 usage를 함께 저장하고, currentTimestamp에 재사용하세요.

개선 예시
-  const sortedUsage = [...usageTimeline].sort(
-    (a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp)
-  )
+  const sortedUsage = usageTimeline
+    .map((usage) => ({ usage, timestamp: Date.parse(usage.timestamp) }))
+    .sort((a, b) => a.timestamp - b.timestamp)
...
-  return sortedUsage.map((usage) => {
-    const currentTimestamp = Date.parse(usage.timestamp)
+  return sortedUsage.map(({ usage, timestamp: currentTimestamp }) => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/web/src/components/dashboard/session-timeline-chart.tsx` around
lines 70 - 81, Update the sortedUsage preparation in the session timeline
mapping flow to parse each usage timestamp once before sorting, storing the
parsed timestamp together with its usage; sort using the stored numeric
timestamp and reuse that value as currentTimestamp inside the map callback. Keep
the existing tool sorting and cumulative count behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/web/src/components/dashboard/session-timeline-chart.tsx`:
- Around line 70-81: Update the sortedUsage preparation in the session timeline
mapping flow to parse each usage timestamp once before sorting, storing the
parsed timestamp together with its usage; sort using the stored numeric
timestamp and reuse that value as currentTimestamp inside the map callback. Keep
the existing tool sorting and cumulative count behavior unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fafa1279-4125-4e87-a632-8daf7f60cc27

📥 Commits

Reviewing files that changed from the base of the PR and between dfe4767 and 88de0a8.

📒 Files selected for processing (3)
  • .jules/bolt.md
  • packages/web/src/components/dashboard/session-timeline-chart.tsx
  • packages/web/src/lib/format.ts

@seonghobae
seonghobae merged commit 4c7fb10 into developmental Aug 12, 2026
29 checks passed
@seonghobae
seonghobae deleted the bolt-performance-date-parse-3456526884730841367 branch August 12, 2026 04:07
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