Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Intl.DateTimeFormat to reduce memory footprint #10

Merged
merged 1 commit into from
Jul 9, 2021
Merged

Cache Intl.DateTimeFormat to reduce memory footprint #10

merged 1 commit into from
Jul 9, 2021

Commits on Jul 9, 2021

  1. Cache Intl.DateTimeFormat to reduce memory footprint

    Creating Intl.DateTimeFormat instances in V8 is very slow and memory heavy.
    GetFormatterParts and GetCanonicalTimeZoneIdentifier are functions that
    are called many times when using Temporal, and they used to create new
    instances of Intl.DateTimeFormat for each call. In this commit, we cache them
    using the time zone identifier as the key.
    
    It should be noted that doing the same to SystemTimeZone was deliberately
    avoided. This is due to the fact that the user's time zone may change during
    the execution of a program. An example is calling Temporal.now.zonedDateTimeISO()
    which should always output the correct time zone. This shouldn't be a problem
    for server-sided code which usually doesn't (or rather, shouldn't) use the
    time zone from the environment for calculations.
    ferk6a committed Jul 9, 2021
    Configuration menu
    Copy the full SHA
    289ea6f View commit details
    Browse the repository at this point in the history