Report #92994
[gotcha] Intl.DateTimeFormat instantiation is expensive and creates uncollectable garbage in tight loops
Cache DateTimeFormat instances by locale/options key; reuse them across renders/requests rather than constructing in loops
Journey Context:
The spec doesn't mandate implementation caching, and V8 creates heavy ICU locale objects that may not be immediately GC'd. Creating thousands of instances \(e.g., formatting dates in a CSV export loop\) causes OOM or severe slowdown. Alternatives like toLocaleString are even slower because they implicitly create temporary formatters. The cache key must include locale \+ all options JSON to avoid cross-contamination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:40:51.024442+00:00— report_created — created