Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aimdb-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ harness = false
name = "b1_b2_remote_json"
harness = false

# Connector-boundary allocations per message (design 054 baseline).
[[bench]]
name = "b0_alloc_connector"
harness = false

[features]
default = ["std"]
# Gates `profiles`/`reports`/`harness` and their criterion/serde_json/
Expand Down
9 changes: 9 additions & 0 deletions aimdb-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Plus two informational benches that exercise the full runner-driven pipeline.
`b1_b2_remote_json` (host). These compare issue #196's direct JSON bytes with
the compatibility `serde_json::Value` tree through the real typed record,
buffer, `Payload` and AimX envelope. Socket I/O and scheduling are excluded.
- **connector boundary** — `b0_alloc_connector` (host). Baseline for design
054: `Router::route`, `pump_source` with a minimal `Source`, and the
per-message `recv_into` + `Connector::publish` calls of `pump_sink`, on a
no-op connector.
- **Embassy** — `b0_alloc_embassy`, `b1_b2_embassy`
(host). These drive the real [`EmbassyBuffer`] backend via
`futures::executor::block_on` over embassy-sync's poll methods — no
Expand Down Expand Up @@ -65,6 +69,9 @@ cargo bench -p aimdb-bench --bench b0_alloc_linkable
# B0 — direct-vs-tree JSON allocations through the AimX envelope boundary
cargo bench -p aimdb-bench --bench b0_alloc_remote_json

# B0 — allocations at the connector boundary (design 054 baseline)
cargo bench -p aimdb-bench --bench b0_alloc_connector

# B1 + B2 — latency (time/iter) and throughput (msgs/sec), one Criterion suite
cargo bench -p aimdb-bench --bench b1_b2_tokio

Expand Down Expand Up @@ -124,6 +131,8 @@ The required result is **0 allocation calls and 0 allocated bytes**. It isolates

`b0_alloc_remote_json` warms the production in-memory `record.get` and subscription-event paths, then compares 5000 tree/direct operations. Its gate is relative: direct JSON must reduce both allocation calls and allocated bytes. It does not require zero allocations because the owned JSON `Vec`, `Arc<[u8]>` payload and AimX envelope serialization still own storage.

`b0_alloc_connector` measures what the connector interfaces cost per message, with no transport. It asserts today's values exactly (0 for `route`, 2 for `pump_source`, 2–3 outbound), so a regression *or* an improvement fails it until `EXPECTED` in the bench and `data/baselines/b0_alloc_connector.json` are updated together. The inbound `pump_source` row is the difference of two runs, so pump setup cancels out. See design 054 for where each allocation comes from.

> **Embassy eager registration (design 039 F8/F9).** An Embassy `SpmcRing` reader registers its embassy `Subscriber` eagerly, at `subscribe()` time — matching Tokio's `broadcast` — so no separate priming step is needed before the first `push`.

**Noise reduction:** a `new_current_thread()` Tokio executor is used so there are no work-stealing threads and Tokio's scheduler does not allocate per-poll in the hot path.
Expand Down
Loading
Loading