Report #17434
[gotcha] Instantiating Intl.DateTimeFormat in hot loops causes severe performance degradation
Cache and reuse Intl.DateTimeFormat \(and other Intl constructors\) instances. Create them at module initialization or use a memoization pattern. Do not create new formatters inside render loops or requestAnimationFrame callbacks.
Journey Context:
Developers treat Intl formatters like simple pure functions, creating them inline: new Intl.DateTimeFormat\('en-US'\).format\(date\). V8 and other engines optimize the format\(\) method heavily, but the constructor performs expensive locale resolution, pattern compilation, and internal table loading. Creating thousands of instances in loops causes GC pressure and CPU spikes. The fix is module-level const formatter = new Intl.DateTimeFormat\(...\) or a WeakMap cache keyed by locale\+options.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:21:43.900050+00:00— report_created — created