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
perf(hotpath): cut per-dispatch and per-batch overhead on the stdio path
Targets the vgi-benchmarks subprocess path (arrow-js + stdio) plus the
flechette backend. Backend-agnostic and both-backend-specific wins:
- server.ts: skip the per-dispatch request-batch serializeBatch (access-log
IPC re-encode) unless a dispatchHook is installed — the default path saves
~17us (arrow-js) / ~10us (flechette) per call. Replace the per-request
getMethods() map copy with Protocol.getMethod()/methodNames().
- arrow-js conformBatchToSchema: add a `mutated` flag + per-child identity
skip so a already-conformant batch returns unchanged (1.81us -> 0.19us);
drain() returns the single buffered chunk without copying.
- flechette deserializeBatch: drop the Proxy wrapper (defeated V8 inline
caches across request parsing) for direct metadata/numRows assignment.
- flechette toFlechetteType: memoize by type-object identity (was re-deriving
the nested type tree per batch).
- wire/writer.ts: fd target writes inline and returns a shared resolved
promise, skipping the promise-chain + microtask hop per emitted batch.
- wire/response.ts coerceInt64: cache int64 field names per schema and skip
the record clone when no coercion is needed.
- wire/request.ts: hoist BigInt safe-integer bounds to module constants.
Verified: 200 vgi-rpc unit tests + 235 vgi-typescript e2e tests pass on both
backends; typecheck + biome clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments