Files
turso/sync
Glauber Costa 22237b05b1 core/vdbe: dispatch through a direct match with register-sized results
Opcode functions returned Result<InsnFunctionStepResult, LimboError>,
a 40-byte value returned through memory on every executed instruction.
The same shape repeated at the step level and across ~350 storage
functions that may suspend for I/O, and LimboError itself was 96 bytes
because one variant stores a parser error inline.

Box the errors so hot results fit in registers:
- LimboError's parser error is boxed (96 -> 40 bytes), with a size
  test pinning it there.
- Opcode functions return InsnResult, 16 bytes, register-returned.
  Errors are boxed where they are created; ? boxes via From.
- The interpreter dispatches through one exhaustive match instead of
  the function-pointer table, with the per-row opcodes inlined into
  their arms. With the old 40-byte results a full match regressed --
  every arm carried its own return-slot plumbing -- but with
  register-sized results it is the fastest shape.
- normal_step and step carry the boxed error too, unboxed once at the
  public Statement boundary.
- Storage-layer functions return IOResultOr<T>, which is 16 bytes and
  register-returned for most payloads.

scan_loop benchmark: select_one_100k -5.7%, select_star_100k -11.7%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-02 07:49:29 -05:00
..