Skip to content

Dynamic computed access: element arms, keyed write sites, interned character strings - #2956

Merged
ctate merged 2 commits into
mainfrom
ctate/dynamic-computed-access-cef25f
Nov 4, 2026
Merged

ctate merged 2 commits into
mainfrom
ctate/dynamic-computed-access-cef25f

Conversation

@ctate

@ctate ctate commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator
  • fasta.js at 1M drops from about 3.2x Node to 1.73x (290.8 ms against 168.1 ms), store-u8 falls from 63.3 to 20.4 ns/op, seq[i].charCodeAt from 172.0 to 90.2, and the read-f64 kernel stands at 39.1 ns/op (Node: 1.94, 5.49 and 16.6).
  • All 56 typed workloads build identical executables with the fast path on and with it off, so the typed lane cannot move; the eight Benchmarks Game ports produce output identical to Node's at their standard input sizes, and the new corpus program matches Node in the plain and sanitized lanes.
  • The fast path is on by default with SCRIPTC_DYN_INDEX_FASTPATH=0 as the opt-out, and the executable cache, the harness build keys and the bootstrap route all key on the emitted shape.

A computed read on a dynamic receiver gains BYTES and STR arms for an
in-range integral Number key (scr_dyn_bytes_index_get /
scr_dyn_string_index_get), and a three-parameter computed write is
classified as a keyedSet site whose array and typed-array arms store
through scr_dyn_index_set. Every other receiver, key and value falls
through to the existing helper, so the assignment-failure mode, coercion
errors and the prototype fence behave as before.

One-character ASCII strings are interned into 128 shared cells, the same
shape as the small-integer cells, so a character read no longer allocates.

The executable and test build caches key on the emitted shape, and the
bootstrap fast path routes around an opt-out so the full compiler sees it.
SCRIPTC_DYN_INDEX_FASTPATH=0 restores the key path. The new corpus program
exercises -0, NaN, fractional and out-of-range keys, numeric-looking string
keys, holes, DataView, BigInt64Array, accessors on the prototype, and
frozen and non-extensible stores.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Nov 4, 2026 4:34am UTC

The small-integer boxes have to exist before main, because their constructor runs unconditionally, and building the 128 character boxes there referenced the string unit's ASCII table. Every program then carried that 4 KiB table plus a page of padding, which pushed the static hello binary past its size limit on macOS.

The character boxes are only reached through scr_dyn_new_str, which a program that never boxes a one-character string does not link, so fill each box where it is first used. A thread claims a box with an atomic compare-exchange and the fields are written before the complete state is published; a thread that finds the box being filled makes a box of its own, which the language cannot tell apart from the shared one.
@ctate
ctate merged commit d83d187 into main Nov 4, 2026
86 checks passed
@ctate
ctate deleted the ctate/dynamic-computed-access-cef25f branch November 4, 2026 05:34

This branch was successfully deployed

1 active deployment
Preview — 6cc45c17 Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant