Skip to content

perf(web): reuse the active trend date formatter - #39

Merged
thomasorgeval merged 1 commit into
mainfrom
bolt-optimizer/reuse-trend-date-formatter
Oct 28, 2026
Merged

thomasorgeval merged 1 commit into
mainfrom
bolt-optimizer/reuse-trend-date-formatter

Conversation

@thomasorgeval

Copy link
Copy Markdown
Member

Summary

  • Reuse the active locale's Intl.DateTimeFormat when formatting Analysis chart period labels instead of repeating ICU formatter setup for every title and accessibility label.
  • Internal benchmark: 43 monthly buckets / 88 label calls per pass improved from 13.84 ms to 2.27 ms median (83.6% less helper time) on Node v26.9.0.
  • Add regression coverage for single dates, date ranges, formatter reuse, and switching locales in both directions.

Expected impact

  • Remove repeated formatter construction during Analysis chart change detection while preserving UTC formatting and localized output.
  • Retain at most one formatter; changing locale replaces it. Alternating locales intentionally reconstruct the formatter rather than growing a cache.
  • The benchmark measures the actual helper, not Angular rendering or browser latency. Browser/end-to-end impact is unmeasured.

Verification

  • Runtime: repository mise configuration, Node v26.9.0 and pnpm 12.5.1 (matching packageManager and engines).
  • pnpm exec vitest run apps/web/src: 8 files, 29 tests passed.
  • pnpm nx typecheck web: passed.
  • pnpm nx lint web: passed.
  • pnpm nx build web: production build passed.
  • pnpm exec oxfmt --check apps/web/src/app/pages/analysis/analysis-trend.ts apps/web/src/app/pages/analysis/analysis-trend.spec.ts: passed.
  • git diff --check: passed.
  • Benchmark command, run before and after with the repository's mise exec -- prefix: node /home/thomas/.hermes/autonomous-coding/runs/20261015T060026Z/artifacts/bibliocards__reviewinbox__bolt-optimizer/benchmark-trend.mjs "$PWD/apps/web/src/app/pages/analysis/analysis-trend.ts".
  • Deterministic synthetic March 2023–September 2026 history; French labels, twice per bucket plus both endpoints (matching template calls). 20 warmup passes, 9 samples of 100 passes; median time per pass reported. Output-length checksums matched. Harness and raw before/after JSON are stored only in the agent artifact directory, not committed.

@thomasorgeval
thomasorgeval marked this pull request as ready for review October 15, 2026 07:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T07:56:01.506633Z 0897074 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-15T07:57:17.944837Z 0897074 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@thomasorgeval
thomasorgeval merged commit 7e23d75 into main Oct 28, 2026
1 check passed
@thomasorgeval
thomasorgeval deleted the bolt-optimizer/reuse-trend-date-formatter branch October 28, 2026 15:29
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