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
Compile sync where provable: maybe-await call sites, sync demotion, let flattening
The eval-capable backend compiled essentially every lambda async and
awaited every head call; only leaf functions over primitives were
demoted to sync. JSC pays heavily for async frames and promise
allocation, making the kernel suite ~2x slower on Bun than Node.
Three changes, all dynamic - eval redefinition keeps working with no
opt-in restrictions:
- Maybe-await: head calls in async contexts compile to
(w$ = $.t(f(...))) instanceof Promise ? await w$ : w$, with one
let-declared slot per function. Callers suspend only when the callee
actually returned a Promise, so redefining any function to an async
replacement just makes call sites take the await branch.
- Structural sync demotion: any compiled arrow whose body contains no
await is emitted as a plain function. Subsumes the leaf rule and adds
tail-call-only functions (their calls are $.b bounces). 66% of
kernel lambdas are now sync.
- Let flattening: inside a function, (let X Y Z) compiles to
(X$tN = Y, Z) with per-function alpha-renaming and block-scoped
declarations instead of an awaited async iife. Awaited iifes in the
rendered kernel: 2330 -> 41 (remaining traps). Fixed a latent alias
bug en route: buildApp's local-callee path used raw SafeId instead of
variable(), breaking alpha-renamed bindings.
- funSyncGeneric over-application chains through then() when settle
yields a Promise (sync wrapper trampolining into an async function).
Kernel certification suite (134/134 everywhere, serial A/B, node
v25.4.0 / bun 1.3.14 / deno 2.8.3): node 15.3s -> 10.1s (~1.58x), bun
33.5s -> 19.5s (~1.77x), deno 13.8s -> 9.8s (~1.49x). AOT artifacts
also faster (fib 210 -> 83 ms under load). All suites green: backend
369, frontend 10, extensions, ratatoskr e2e, smoke on all three
runtimes, REPL interactive smoke.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments