Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
Binary size checks failed❌ 2 violations · ✅ 1 passed
Details & how to fixViolations:
Add/update baselines:
[artifacts.bridge_wasm]
file_bytes = 26531638
gzip_bytes = 7772879
[artifacts.packed-program]
file_bytes = 40516416
gzip_bytes = 16488639Generated by |
ebc77cd to
30e09f5
Compare
30e09f5 to
73deee6
Compare
73deee6 to
f54a874
Compare
f54a874 to
f2741a2
Compare
f2741a2 to
3304a26
Compare
3304a26 to
22a6661
Compare
22a6661 to
c13a038
Compare
c13a038 to
a4db2a4
Compare
…er ones A function-typed parameter makes its function generic over the argument's `throws`, so `apply(f, x)` passes one type argument. The load-time call specializer only used CALL_EXACT_ARGS for calls with no type arguments, so every higher-order call (and every generic call) took the general path: leave the dispatch loop, copy the type arguments through three vectors, look up the call layout and push the frame there. CALL_EXACT_ARGS now covers sites that pass every type argument the callee declares. When every type operand is a plain static type, the operands go straight into the new frame and dispatch stays in run_compact; any other operand still takes the general path. LOAD_TYPE's static cache now hashes with FxHash instead of SipHash. speedtest vm-off, ns per iteration (canary -> this): compute/closure-apply-1m 415 -> 230 compute/pure-call-1m 70.8 -> 71.4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…compact dispatch A call through a function value always took the general path: a callable resolve, layout remap, the general frame push, and a return to `exec_compact` to re-derive the frame's function, code and pc. A bytecode function or closure whose parameter slots are exactly what the site pushed now enters the way `CallExactArgs` does (closure type arguments seeded into the frame, same telemetry entry as the general path) and stays in `run_compact`. Hooked and pass-through callees, pending trace or type lanes, remapped layouts, bound methods, host closures and generic function values keep the existing path. The entry is out of line: inlined into `run_compact` it made every ordinary exact call ~10 instructions slower. Instructions per iteration (20M loop minus empty run): direct capturing closure call 1460 -> 1093, `apply(double, i)` 2329 -> 1958, `leaf(i)` 860 -> 858. speedtest vm-off: closure-apply-1m 230.0 -> 193.7 ns/iter, pure-call-1m 71.5 -> 71.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a4db2a4 to
58bda26
Compare
Calling a closure you were handed is about 2.2x faster. That's the call inside every callback API: a helper taking
fn,list.map((x) -> ...),sem.with(fn),baml.sync.atomic(key, fn). No change in behavior.Numbers
Release build, VM, telemetry off, both binaries built from the same canary and run alternately, seven runs each:
What was slow
Passing a closure to a function. A function-typed parameter makes its function generic over the argument's
throws, soapply(f, x)passes a hidden type argument. The call specializer only used its fast instruction for calls with no type arguments, so every higher-order call, and every explicit generic call likeg<T>(x), took the general path. That meant leaving the dispatch loop, allocating while copying the type arguments, looking up the call layout and pushing the frame the slow way.Calling the closure (
fn()) always took the general path too.Changes
Risks / what to review
bex_vm/src/vm.rs). Each must match the general path exactly: type arguments, telemetry entry, frame layout. Anything unusual (hooks, pass-through, load-time compiled callees, remapped layouts, bound methods, host closures, generic function values) falls back to the general path.Testing
bex_vm/tests/call_exact_args.rs: the test that pinned the old behavior now checks thatbaml.json.decode<int>("42")works on the fast path, and fails if the type argument isn't passed through.bex_vmandbex_enginesuites and the full runtime corpus pass on top of this stack.Stack
baml.sync.atomic(Add baml.sync.atomic for guarding an object's own state #5661)baml.sync.Semaphore(Replace baml.spawn.Limit with baml.sync.Semaphore #5352)🤖 Generated with Claude Code
Summary by CodeRabbit