Standalone tsx script benchmarking the codecs generated by
@snowluma/proton against the existing src/protobuf/decode.ts runtime
implementation, using the actual long-message schemas already in the
codebase (the proton interface form + the legacy *Schema constants).
Proton codecs are materialised at bench startup via the public
analyzeSource + generateCode API — exactly what the Vite plugin does at
build time — so there is no chicken-and-egg dependency on a Vite build.
Headline numbers on Node 24 / darwin-arm64:
- simple 4×uint32 encode: ~8.5× speedup
- simple 4×uint32 decode: ~35× speedup
- deeply nested SendLongMsgReq encode: ~9.5×, decode: ~13×
- 64-byte payload RecvLongMsgResp encode: ~4.3×, decode: ~10×
Run with:
pnpm --filter @snowluma/core exec tsx bench/proton-vs-legacy.ts