You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JS String.to_list builds its list through recursive Base calls #1680
The native string representation is unpacked through String.to_list recursion. A single forward walk can allocate the required cells directly without recursive call frames or a temporary character array. Heads must stay Char values, including astral and non-scalar U32 values.
On e5527d5 (Bend 2.0.37), Linux x64, Bun 1.3.13, I measured actual exported module calls. The table uses medians of seven interleaved before/after rounds with identical input, including module conversion; no standalone JS reference is substituted for the patched compiler.
Export
Calls
Current main, ms
Local native path, ms
to_list
100
15.146
3.901
Library (lib.bend):
import Base
def to_list(s: String) -> List<&2, Char>:
String.to_list(s)
Compile with bun bend2/main.ts lib.bend -o lib.mjs. This standalone driver (bench.mjs) reproduces the baseline workload; run it with bun bench.mjs:
The local implementation passed 2936 API checks covering full-width U32 Chars, all 1024 astral scalars with low unit DC00, first-class references, and numeric bounds. Existing string/read programs and a new packed-Char fixture also ran on JS and native C. These are local workloads, not a general speed guarantee. No parser, kernel or cap change is needed.
Activity