镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Intl.DateTimeFormat: project resolved field enums through static cells #603

Closed

Description

@chrisbbreuer

Parents: #475, #479
Related: #461, #493, #602

Problem

IntlDateTimeFormatData.Field is already a closed native enum whose string() method returns one of the ECMA-402 fixed field/style names. Intl.DateTimeFormat.prototype.resolvedOptions() currently turns those enum values back into byte slices and allocates a managed StringCell for every non-empty component and style on every call.

The existing representative_intl_date_time_format_construct_components row performs 3,200 constructor + resolvedOptions() operations per 100 jobs. On current main (e9d641d3), its exact invocation delta after warmup is 140,817 managed-cell allocations and 265,626 backing allocations with checksum 914,759,620. This issue will isolate the enum projections inside that unchanged workload.

Scope

  • Add an exact Value projection for every non-empty IntlDateTimeFormatData.Field case using immutable static StringCells.
  • Use that projection for resolved component names and dateStyle / timeStyle only; locale, calendar, numbering-system, time-zone, and other dynamically owned strings remain on their existing path.
  • Preserve ECMA-402 property presence and insertion order, component/style exclusivity, exact bytes, forced-GC lifetime, and all constructor option-observation behavior.
  • Measure exact-parent cell/backing allocation deltas and order-balanced paired timing on default, component, style, and locale constructor rows.

No-workaround rules

  • Do not cache or reuse the observable resolved-options object, skip fields the benchmark does not read, recognize benchmark source/name, intern attacker-controlled strings globally, or weaken GC ownership.
  • Do not touch Promise, microtask, Worker, Thread lifecycle, stacks, queues, or jobs code.

Acceptance

  • Every emitted Field value is the exact unmanaged static cell for its spec spelling; .none remains absent.
  • The existing workload keeps identical work, option objects, property order, and checksum while exact cell/backing allocations fall by the predicted number of emitted enum strings.
  • Exact test262 DateTimeFormat coverage has zero flips/regressions.
  • Focused normal/TSan, bounded/moving GC, and full sharded unit gates pass.
  • Paired timing and allocation evidence are recorded even if the wall result is neutral; no broad performance claim is made without evidence.

Security boundary

Option objects and call frequency are attacker-controlled. The optimization must only project validated closed enum state and must not introduce mutable global caches, lifetime ambiguity, or any fallback from dynamic string ownership.

Activity

  1. added
    performanceMeasured runtime, memory, scaling, or build performance
    runtimeJavaScript runtime and builtin implementation
    on Aug 16, 2026
  2. chrisbbreuer commented on Aug 16, 2026

    @chrisbbreuer
    MemberAuthor

    Implemented and pushed to main in 10ac2f3d (perf(intl): reuse static resolved field strings (#603)).

    IntlDateTimeFormatData.Field now projects every non-empty ECMA-402 component/style spelling through its exact immutable static StringCell; .none remains absent. Dynamic locale, calendar, numbering-system, time-zone, and other owned strings are unchanged.

    Exact 3,200-operation allocation evidence:

    • default: 124,808 -> 115,208 managed cells (-9,600; 3 per operation)
    • components: 140,817 -> 118,417 (-22,400; 7 per operation)
    • style: 124,812 -> 118,412 (-6,400; 2 per operation)
    • locale: 156,815 -> 147,215 (-9,600; 3 per operation)
    • component GC cell bytes: 18,638,656 -> 17,205,056 (-1,433,600)
    • component backing allocations: 265,626 -> 243,226 (-22,400)

    Execution counters, Shape requests, and frozen checksums are identical. In 21 order-balanced component-row pairs, median wall time is 81.766750 ms -> 79.220792 ms (-3.114%), with 21/21 candidate wins. The other rows range from -0.280% to +0.307%, so no broad throughput claim is made.

    Validation:

    • exact test262 DateTimeFormat: 244/244 pass before and after, 0 failures/flips
    • all 11 spellings: exact unmanaged cell identity before and after forced GC; normal and TSan pass
    • focused DateTimeFormat bounded/moving/parallel/OOM group: 9/9 pass
    • full units: 1,719 passed, 1 skipped, 0 failed, 0 leaked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceMeasured runtime, memory, scaling, or build performanceruntimeJavaScript runtime and builtin implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions