Skip to content

Frontend/perf: Cache Intl.DateTimeFormat objects.#8122

Merged
tristanlabelle merged 1 commit into
developfrom
frontend/feature/cache-intl-datetimeformat
Mar 23, 2026
Merged

Frontend/perf: Cache Intl.DateTimeFormat objects.#8122
tristanlabelle merged 1 commit into
developfrom
frontend/feature/cache-intl-datetimeformat

Conversation

@tristanlabelle

Copy link
Copy Markdown
Contributor

Adds a cache for Intl.DateTimeFormat objects since I read around the internet that it's recommended and this benchmark confirms it's much faster on my machine.

Test case name Result
new Intl.DateTimeFormat.format() new Intl.DateTimeFormat.format() x 23,943 ops/sec ±3.33% (56 runs sampled)
cached Intl.DateTimeFormat.format() cached Intl.DateTimeFormat.format() x 976,681 ops/sec ±1.87% (62 runs sampled)

Unbounded cache size growth isn't a concern. This will clear on navigation and I expect the most different formats a given page will have will be in the low single digits.

Testing

Verified two different date formats can still be shown.

image

Web frontend checklist

  • There are no console warnings when running the app
  • Added tests where relevant
  • Clicked around my changes running locally and it works
  • Checked Desktop, Mobile and Tablet screen sizes

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview Mar 18, 2026 8:12am

Request Review

@tristanlabelle
tristanlabelle marked this pull request as ready for review March 18, 2026 08:44
@tristanlabelle
tristanlabelle requested review from a team and aapeliv March 18, 2026 08:44
@tristanlabelle
tristanlabelle merged commit 00a7bd0 into develop Mar 23, 2026
12 checks passed
@tristanlabelle
tristanlabelle deleted the frontend/feature/cache-intl-datetimeformat branch March 23, 2026 02:59
@github-actions

Copy link
Copy Markdown
Contributor

📝 Release Notes

This PR does not need to be included in release notes.

Reason: This is a small frontend performance optimization that caches date formatter objects internally. While it may slightly improve efficiency, it does not introduce a user-visible feature, significant UX change, important bug fix, or major infrastructure improvement that end users would notice in release notes.

🤖 Bot Debug Information

Model: couchers.openai.gpt-5.4
Decision: exclude
Reasoning: This is a small frontend performance optimization that caches date formatter objects internally. While it may slightly improve efficiency, it does not introduce a user-visible feature, significant UX change, important bug fix, or major infrastructure improvement that end users would notice in release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants