Skip to content

Should we be caching the ICU4X dates? #505

@Manishearth

Description

@Manishearth

Almost any Temporal object will contain an ISODate, and when you access it for calendared information, it will construct a Date<AnyCalendar> on the fly via Calendar::from_iso().

This seems inefficient: 99% of the time we have constructed a date we already have the from-ISO value; and even if we don't, most useful methods on Date need to call this. In some cases we can rely on the optimizer to inline and collapse consecutive from_iso() calls, but that won't work e.g. over FFI.

We should benchmark some of this, too.

Useful workloads:

  • Constructing a date (via various methods)
  • Calling .to_ixdtf_string()
  • Calling a single calendared getter on a date
  • Calling most calendared getters on a date, e.g. for formatting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions