ReviewOS

zig-utils/zig-js

Temporal: batch proven ordinary duration-bag reads

#594
Closed chris opened this 9 days ago ·
9 days ago

Parent: #475 Depends on: #460

Profile

The frozen representative_temporal row spends the hottest sampled portion of both Temporal.PlainDate.prototype.add and Temporal.Instant.prototype.add inside durationFromArg, which performs ten independent ordinary [[Get]] operations for each one-field duration literal. A 100-job attribution records 90,315 property-lock acquisitions, 24,741 Shape transitions, 80,824 backing allocations, and 47,788 GC cells.

Scope

  • Add one reusable, synchronization-correct snapshot primitive for a fixed ordered set of ordinary named data properties.
  • Use it only for exact ordinary duration bags whose receiver/prototype descriptors prove that every duration field is an own or inherited data property with a conversion-safe primitive value.
  • Fall back to the existing spec path before any user-observable operation for accessors, Proxies, host objects, exotic receivers, cross-realm/custom prototype chains, and object-valued conversions.
  • Preserve Temporal field Get order, per-field conversion order, TypeError/RangeError order, prototype shadowing, and concurrent mutation linearizability.

Acceptance

  • Focused tests cover own/inherited data, getters, Proxies, object-valued conversion, field order, errors, and prototype mutation.
  • Focused normal and TSan gates pass without leaks or engine-state races.
  • Temporal test262 subtrees remain exact.
  • Exact-parent attribution shows the retained path reduces work without checksum drift.
  • Full sharded unit suite passes.

No-workaround rules

No skipped observable Get, cached user bag, immutable-Object.prototype assumption, hidden mutation, broad exotic fast path, or weakening of no-GIL synchronization.

9 days ago

Implementation and validation are complete. The retained path snapshots only exact ordinary numeric data bags; all accessors, Proxies, host hooks, custom/cross-realm prototypes, and object-valued conversions fall back before observable work.

Exact-parent (724c3d73) 21-pair order-balanced results at 1,000 jobs, with matching checksums:

  • representative_temporal: 152.644 ms -> 117.529 ms median (-23.00%)
  • representative_temporal_variant: 149.147 ms -> 116.840 ms median (-21.66%)

The 100-job checksum remains 202578610542; allocation, GC-cell, collection, and property-lock counts remain exact because this change removes repeated descriptor/prototype probing rather than object construction.

Validation:

  • focused normal: 1/1, zero leaks
  • focused TSan: 1/1, zero leaks/races
  • test/built-ins/Temporal: 4,603/4,603
  • test/intl402/Temporal: 2,029/2,029
  • full units: 1,708 passed, 1 skipped, 0 failed, 0 leaked
9 days ago

Landed on main in b795eeb2. The commit contains the guarded ordinary-data snapshot, Temporal integration, semantic regression, exact-parent performance evidence, and full validation described above.

9 days ago

Follow-up #595 landed in 6be183d3, replacing #594's repeated per-name shallow Shape walks with one bounded exact-classifier scan while preserving its accessor/deep-shape fallback.

Sign in to comment on this issue.