You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#7 and #8 showed that new DateTimeFormat() is astoundingly expensive in time and memory. Big perf wins come from caching these instances.
The constructor for DateTimeFormat in this polyfill (which is called in every toLocaleString call) calls the builtin Intl.DateTimeFormat constructor 8 times. This will be slooooooooooow.
All those instances are probably unnecessary. At a minimum, we should lazy-init these instances so they're only constructed when needed. Given that users typically re-use the same options over and over, we could also consider caching DateTimeFormat instances too.
The text was updated successfully, but these errors were encountered:
#7 and #8 showed that
new DateTimeFormat()
is astoundingly expensive in time and memory. Big perf wins come from caching these instances.The constructor for DateTimeFormat in this polyfill (which is called in every toLocaleString call) calls the builtin
Intl.DateTimeFormat
constructor 8 times. This will be slooooooooooow.All those instances are probably unnecessary. At a minimum, we should lazy-init these instances so they're only constructed when needed. Given that users typically re-use the same options over and over, we could also consider caching DateTimeFormat instances too.
The text was updated successfully, but these errors were encountered: