mirror of
https://github.com/zap-proto/rust.git
synced 2026-11-02 16:34:36 +00:00
Cap'n Proto was the canonical name for this Rust implementation. The
ZAP rebrand had only been applied as a directory rename so far —
crate names, schema file extensions, import paths, and binaries all
still said `capnp` / `capnpc`. This commit makes the rebrand real.
Workspace renames:
- crate capnp/ → zap/ (name = "zap")
- crate capnpc/ → zapc/ (name = "zapc")
- crate capnp-futures/ → zap-futures/
- crate capnp-rpc/ → zap-rpc/
Source-file renames:
- *_capnp.rs → *_zap.rs (~12 files: schema_zap.rs, rpc_zap.rs, etc.)
- capnpc-rust.rs → zapc-rust.rs (the codegen binary entry point)
- *.capnp → *.zap (33 schema files)
Identifier renames across the workspace (96 files rewritten):
- `use capnp::` → `use zap::`
- `extern crate capnp` → `extern crate zap`
- `capnp::generated_code!` → `zap::generated_code!`
- `capnp::traits::Owned` → `zap::traits::Owned`
- `capnp::message::...` → `zap::message::...`
- `capnp::Error/Result` → `zap::Error/Result`
- `capnp::Word` → `zap::Word`
- `capnp::primitive_list` → `zap::primitive_list`
- `capnp::any_pointer` → `zap::any_pointer`
- (etc. — see python script in commit history for full list)
Cargo.toml dep keys:
- `capnp = { path = ... }` → `zap = { path = ... }`
- `[dependencies.capnp]` → `[dependencies.zap]`
- `capnpc = { ... }` → `zapc = { ... }`
- Per-crate name= field and bin = "capnpc-rust" → "zapc"
Schema header strip:
- `using Cxx = import "/capnp/c++.capnp";` lines removed (C++ binding
hints; Rust output doesn't need them, and they referenced a system
/usr/include path we don't ship)
- `$Cxx.namespace("capnp::...")` annotations removed
Build-time decoupling for the benchmark:
- Pre-generated `carsales_zap.rs`, `catrank_zap.rs`, `eval_zap.rs` are
now committed in benchmark/. benchmark/build.rs just copies them
into OUT_DIR instead of invoking the schema compiler at build time.
- benchmark/Cargo.toml drops the [build-dependencies] zapc entry.
Building the benchmark needs ONLY the `zap` runtime crate; no
schema-compiler binary, no plugin, no shell-out.
To regenerate the schema-bound .rs from .zap (developer-only step):
cargo build --release --bin zapc
ln -sf zapc target/release/capnpc-rust # plugin discovery name
cd benchmark && PATH=../target/release:$PATH \
capnp compile -orust eval.zap catrank.zap carsales.zap
The `capnp` tool here is the upstream C++ schema-text parser — only
used as a parser frontend at codegen time, never linked into the
benchmark binary. Runtime + build = 100% zap/zapc only.
Verified by:
cargo tree -p benchmark --release → no capnp dep
grep -rE 'capnp|Capnp|CAPNP' . → 0 hits in active source
cargo build -p benchmark --release → clean build, no system tool
bash ./benchmark/bench.sh quick → runs end-to-end
Other workspace members (fill_random_values, addressbook,
wasm-hello-world, capnpc/test fixtures) still use build.rs schema
compilation at build time; they require a `zap` binary in PATH.
That's pre-existing — the upstream Cap'n Proto Rust workspace had the
same requirement against the `capnp` binary. Out of scope for this PR.
29 lines
3.1 KiB
JSON
29 lines
3.1 KiB
JSON
{
|
|
"schema_version": 1,
|
|
"host": {"hostname":"ra","os":"macos","arch":"aarch64"},
|
|
"toolchain": {"rustc":"rustc 1.95.0 (59807616e 2026-04-14) (Homebrew)"},
|
|
"iters": {"carsales":500,"catrank":50,"eval":10000},
|
|
"runs": [
|
|
{"case":"carsales","mode":"object","compression":"none","scratch":"reuse","iters":500,"elapsed_secs":0.260886,"throughput_ops_per_sec":1916.5},
|
|
{"case":"carsales","mode":"object","compression":"none","scratch":"no-reuse","iters":500,"elapsed_secs":0.011232,"throughput_ops_per_sec":44515.8},
|
|
{"case":"carsales","mode":"bytes","compression":"none","scratch":"reuse","iters":500,"elapsed_secs":0.012229,"throughput_ops_per_sec":40887.3},
|
|
{"case":"carsales","mode":"bytes","compression":"none","scratch":"no-reuse","iters":500,"elapsed_secs":0.012656,"throughput_ops_per_sec":39506.7},
|
|
{"case":"carsales","mode":"bytes","compression":"packed","scratch":"reuse","iters":500,"elapsed_secs":0.022127,"throughput_ops_per_sec":22596.4},
|
|
{"case":"carsales","mode":"bytes","compression":"packed","scratch":"no-reuse","iters":500,"elapsed_secs":0.022509,"throughput_ops_per_sec":22213.2},
|
|
{"case":"carsales","mode":"pipe","compression":"none","scratch":"reuse","iters":500,"elapsed_secs":0.030357,"throughput_ops_per_sec":16470.7},
|
|
{"case":"carsales","mode":"pipe","compression":"none","scratch":"no-reuse","iters":500,"elapsed_secs":0.045953,"throughput_ops_per_sec":10880.7},
|
|
{"case":"carsales","mode":"pipe","compression":"packed","scratch":"reuse","iters":500,"elapsed_secs":0.062478,"throughput_ops_per_sec":8002.9},
|
|
{"case":"carsales","mode":"pipe","compression":"packed","scratch":"no-reuse","iters":500,"elapsed_secs":0.048263,"throughput_ops_per_sec":10360.0},
|
|
{"case":"catrank","mode":"object","compression":"none","scratch":"no-reuse","iters":50,"elapsed_secs":0.028687,"throughput_ops_per_sec":1742.9},
|
|
{"case":"catrank","mode":"bytes","compression":"none","scratch":"no-reuse","iters":50,"elapsed_secs":0.027769,"throughput_ops_per_sec":1800.5},
|
|
{"case":"catrank","mode":"bytes","compression":"packed","scratch":"no-reuse","iters":50,"elapsed_secs":0.032075,"throughput_ops_per_sec":1558.8},
|
|
{"case":"catrank","mode":"pipe","compression":"none","scratch":"no-reuse","iters":50,"elapsed_secs":0.029441,"throughput_ops_per_sec":1698.3},
|
|
{"case":"catrank","mode":"pipe","compression":"packed","scratch":"no-reuse","iters":50,"elapsed_secs":0.035877,"throughput_ops_per_sec":1393.6},
|
|
{"case":"eval","mode":"object","compression":"none","scratch":"no-reuse","iters":10000,"elapsed_secs":0.025938,"throughput_ops_per_sec":385539.1},
|
|
{"case":"eval","mode":"bytes","compression":"none","scratch":"no-reuse","iters":10000,"elapsed_secs":0.029484,"throughput_ops_per_sec":339167.5},
|
|
{"case":"eval","mode":"bytes","compression":"packed","scratch":"no-reuse","iters":10000,"elapsed_secs":0.045671,"throughput_ops_per_sec":218955.1},
|
|
{"case":"eval","mode":"pipe","compression":"none","scratch":"no-reuse","iters":10000,"elapsed_secs":0.109929,"throughput_ops_per_sec":90968.0},
|
|
{"case":"eval","mode":"pipe","compression":"packed","scratch":"no-reuse","iters":10000,"elapsed_secs":0.120468,"throughput_ops_per_sec":83009.7}
|
|
]
|
|
}
|