Evidence
“Pay only for what you use” is a claim, so it gets measured: against a plain-Rust control, with matched toolchain and flags, alternating paired runs, and the raw samples kept.
Read these as budgets, not guarantees. All numbers come from one machine (AMD Ryzen 5 PRO 4650U, Linux, Rust 1.96.1, release profile) with small sample counts and uncontrolled OS page caches. They exist to catch regressions and expose costs, not to rank frameworks.
Phase 1 · Pico against plain Rust#
| Metric | Plain Rust | Pico | Delta |
|---|---|---|---|
| Dependency packages (excl. app) | 0 | 1 (facade) | +1 |
| Facade's own dependencies | — | 0 | — |
| Clean build, median | 232.40 ms | 269.18 ms | +36.78 ms |
| Unchanged rebuild, median | 133.48 ms | 135.15 ms | +1.67 ms |
| Comment-edit rebuild, median | 217.30 ms | 228.16 ms | +10.86 ms |
| Unstripped binary | 4,335,592 B | 4,335,592 B | 0 |
| Process wall time, median | 1.203 ms | 1.256 ms | +0.054 ms |
Process samples overlap almost entirely (plain 0.899–2.292 ms, Pico 0.898–2.257 ms). A separate allocation probe with positive controls measured zero allocations added by the facade: 0 for the empty entrypoint, identical counts for stdout and a user Box. The clean-build delta, about 16%, is the initial budget to defend.
Phase 2 · Capability resolution#
An in-process microbenchmark compares direct typed access with unique resolution and explicit selection at increasing candidate counts. The tested behaviour — missing, ambiguous, selected, cyclic, and 2,048-module acyclic chains validated without stack growth — is listed on Modules.
Phase 3 · Contributions#
| Metric | Result |
|---|---|
| Target assembly, two declarations | 86 ns/op median (samples 84–96 ns) |
| Runtime tree storage | 96 B for two entries, including backing capacity |
| Clean build | 1.116 s median |
| Unchanged rebuild | 61.84 ms median |
| Executable size | 4,367,280 B |
| Process wall time | 1.736 ms median |
| Internal dependencies | 2 (Core, Kernel); no facade |
Phase 4 · Processes#
Projection and freeze are measured and their behaviour is covered by integration tests; see Processes. The runtime plan and the inspection output come from the same frozen resolution.
Phase 5 · Lifecycle and Runtime#
The same lifecycle executable, built with the default features and with the optional Tokio adapter:
| Metric | Default | Tokio feature |
|---|---|---|
| Clean release build, median (n=3) | 2.241 s | 6.525 s |
| Unchanged build, median (n=3) | 47.11 ms | 57.85 ms |
| Release executable | 4,626,176 B | 4,673,872 B |
| Resolved dependency packages | 3 | 17 |
| Process wall time, median (n=3) | 1.337 ms | 1.457 ms |
Task supervision over 4,500 tasks, nine samples: direct work 7 ns/task with no allocations; ManualRuntime 601 ns/task, 5 allocations, 96 requested bytes; the Tokio blocking-task adapter 1.105 ms/task, 7 allocations, 360 bytes. Managed Tokio startup measured 164 μs. The Tokio path uses spawn_blocking, so these are microbenchmarks, not a service workload. Readiness (5 ms) and full shutdown (14 ms) come from a deterministic fake clock and test ordering, not hardware speed.
Phase 6 · HTTP and PostgreSQL#
One Users domain, three builds. What you do not select stays out of the graph:
| Target | Resolved deps | Clean build | Unchanged rebuild | Release binary |
|---|---|---|---|---|
| Console only | 8 | 3.439 s | 102.3 ms | 521,712 B |
| HTTP workload | 62 | 17.940 s | 108.3 ms | 1,982,280 B |
| PostgreSQL workload | 160 | 40.850 s | 134.6 ms | 5,651,192 B |
Paired release workloads, seven samples, the same Users operation on both sides:
| Path | Direct | Through Clamp | Ratio |
|---|---|---|---|
| HTTP request, median | 3,728 ns · 40 allocs · 3,519 B | 6,857 ns · 69 allocs · 7,165 B | 1.84× |
| PostgreSQL read, median | 184.4 μs · 20 allocs · 12,832 B | 167.0 μs · 25 allocs · 13,123 B | 0.91× |
The Clamp HTTP path also runs contributed routing, request middleware and content negotiation; that is where the extra 3.1 μs and allocations go. The PostgreSQL difference is within local host noise — read it as “no measurable overhead”, not as faster. Allocation counts come from stats_alloc in the measurement examples only.
Phase 7 · Messaging and workers#
Behaviour evidence first: against PostgreSQL 18.6 and NATS JetStream 2.11, the CreateOrder API kept committing while the publisher and then the broker were down, and the outbox published once they returned. A Worker killed before its inbox transaction committed was redelivered after the 45-second lease and fulfilled the order exactly once; induced duplicates were skipped by the durable inbox. An injected failure on outbox insert rolled back the inventory update and the order. This verifies the tested crash windows, not exactly-once broker delivery.
| Measure | Result |
|---|---|
| Serial publish with confirmation | 4,510 msg/s median (3,792–5,238, n=3) |
| Email API, start to broker confirmation to exit | 8 ms median (6–11 ms) |
| Idle Worker, signal to exit | 1.0 ms |
| Resolved packages | Capability-only 2 · Scheduler 10 · Email worker 122 · CreateOrder 201 |
The publish figure is a confirmation microbenchmark, not end-to-end Worker throughput. Active-job shutdown latency depends on the workload and is not represented by the idle number.
Phase 8 · Loops and scale#
Kernel projection time for one reachable chain through N declared modules; composition construction is outside the timed region.
| Modules | Median projection time |
|---|---|
| 1 | 354 ns |
| 5 | 2,953 ns |
| 20 | 18,450 ns |
| 50 | 71,168 ns |
| 100 | 201,434 ns |
| 500 | 1,860,911 ns |
Over 100,000 steps the direct Rust loop measured 0.627 ns/step and the runtime-driven loop 5.661 ns/step; the 5.034 ns difference is the cancellation check, controlled-clock advance and iterator boundary. The composed device binary is 669,872 B against 446,760 B for direct Rust. Projection happens once, before a process runs; the per-step cost is what a loop pays. See Loops and devices.
Phase 9 · Tooling#
Phase 9 is verified by behaviour rather than timing. The CLI's inspect, tree, graph and why output is compared in the check runner against the real resolved projections of examples 04, 05, 09 and 11 — a comparison that caught and fixed quoted IDs in graph output. The installer was run from the live URL with an isolated Cargo home: clamp --help, clamp init and cargo run of the generated app all passed. The same Rust server (example 13) returned byte-identical responses to the Python preview for every checked route of both sites. The opt-in exporters leave each example's default dependency graph unchanged. See Clamp CLI.
Reproduce#
# from the coordinated checkout (see Getting started)
python3 rustclamp/tools/pico.py --check
python3 rustclamp/tools/pico.py --measure rustclamp/docs/evidence/reports/phase1-pico.json
python3 rustclamp/tools/check.py
cargo run --locked --manifest-path rustclamp/examples/01-users/Cargo.toml --features http,measure-allocations --release --example measure-http
Reports are versioned JSON with compiler, target, machine, source fingerprint, commands, cache conditions and raw timings. Full write-ups: rustclamp/docs/evidence.