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
Specialize function wrappers by arity to avoid rest/spread on the hot path
Every Shen-level call went through a variadic (...args) wrapper that
allocates a rest array and re-spreads it, purely to support currying.
V8 partially optimizes this; JSC materializes the array every call,
making Bun ~2x slower than Node on call-heavy code despite comparable
raw-recursion speed.
funSync/funAsync now emit fixed-parameter wrappers for arities 0-4
(101/102 defuns in a shaken kernel), using arguments.length to detect
exact application and falling back to the extracted generic path for
partial/over/zero-arg application and arity > 4. Semantics preserved
branch-for-branch, including the arity:NaN quirk for partials of raw
closures; async wrappers remain AsyncFunction instances for fun's
dispatch and js.async?.
fib(32) standalone artifact, end-to-end: node 393->182 ms, bun
600->128 ms - bun now matches luajit (~130 ms) on this workload. All
suites green: backend 369, kernel 134/134, extensions, ratatoskr e2e,
frontend, bun smoke.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments