Real Cap'n Proto C++ in the browser. Typed RPC, binary wire.
One typed-client toolchain for any backend — write a .capnp schema, get
a fast typed JS client back. npx capnwasm gen user.capnp emits a reader/builder
that runs against real upstream Cap'n Proto C++ statically compiled to wasm.
capnwasm is me trying to learn Cap'n Proto and capnweb by building the opposite experiment: keep the real Cap'n Proto binary wire in the browser, compile the upstream C++ runtime to wasm, and measure what changes.
This is not a scoreboard where Cap'n Proto always wins. The useful question is the tradeoff boundary: when does zero-copy / sparse access / raw binary pay off, and when is JSON or capnweb the better choice?
Every number below is measured either in this browser against the current Worker server, or generated at build time from the current assets. No hardcoded benchmark values.
createClient + subscribeQuery + optimistic
in a working chat. Open in two tabs to watch messages stream live across.
.capnp,
and round-trip back to canonical OpenAPI in the browser.
/inspect.js
on this site — not in the npm package.