Skip to content

Commit fbcf630

Browse files
committed
feat(acl): criterion benchmarks + nix bench-builder
Adds criterion benchmarks for both backends at v4 and v6 widths, plus the nix / just plumbing to produce bench binaries from a sandboxed build. acl/benches/: - reference_five_tuple.rs sweeps a deep miss (full per-rule scan) and an early hit through the reference's O(rules * fields) linear scan. Both widths. - dpdk_five_tuple.rs is the rte_acl companion: trie walk cost (close to flat in rule count), miss vs hit, single-shot vs SIMD batch. v6 exercises the wide-field split (one 16-byte address -> four 4-byte sub-fields). Requires a live EAL. - table_build.rs measures construction cost vs rule count: reference (lower + Vec wrap) and DPDK (rte_acl_build, the update-latency cost). Both widths. iter_batched so teardown is excluded. acl/Cargo.toml gets the criterion dev-dep and three harness = false [[bench]] entries. Workspace Cargo.toml gets the criterion = 0.5.1 shared dep entry. default.nix adds a bench-builder derivation: cargo bench --no-run under the profile-appropriate DPDK sysroot, then copies each compiled benchmark into $out/bin (stripping cargo's -<hash> suffix). Linked against the optimized DPDK when profile = release. justfile adds a bench recipe that builds the benches package and runs every binary under results/benches/bin/ in turn. just fmt; cargo check --workspace --all-targets and cargo clippy -p dataplane-acl --features dpdk -- -D warnings pass. Signed-off-by: Daniel Noland <daniel@githedgehog.com>
1 parent db13ea7 commit fbcf630

8 files changed

Lines changed: 716 additions & 14 deletions

File tree

Cargo.lock

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ chrono = { version = "0.4.45", default-features = false, features = [] }
127127
clap = { version = "4.6.1", default-features = true, features = [] }
128128
color-eyre = { version = "0.6.5", default-features = false, features = [] }
129129
colored = { version = "3.1.1", default-features = false, features = [] }
130+
criterion = { version = "0.8.2", default-features = false, features = [] }
130131
crossbeam-utils = { version = "0.8.21", default-features = false, features = [] }
131132
dashmap = { version = "6.2.1", default-features = false, features = [] }
132133
derive_builder = { version = "0.20.2", default-features = false, features = [] }

acl/Cargo.toml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ version.workspace = true
77

88
[features]
99
default = []
10-
# Enables the DPDK `rte_acl` backend for `cascade::Lookup`. Pulls in
11-
# the `dpdk` crate (and transitively `dpdk-sys`), so off by default;
12-
# only the production binary / DPDK-bound consumers turn it on. The
13-
# reference backend (always built) carries its own `thiserror`-derived
14-
# error types, so `thiserror` is unconditional rather than feature-gated
15-
# under `dpdk`.
1610
dpdk = ["dep:dpdk"]
1711

1812
[dependencies]
@@ -25,13 +19,20 @@ net = { workspace = true, features = [] }
2519
thiserror = { workspace = true }
2620

2721
[dev-dependencies]
28-
# Differential oracle harness: random rulesets + packets compared
29-
# between the reference and DPDK backends.
3022
bolero = { workspace = true, features = ["std"] }
31-
# Override the regular `dpdk` dep to enable its `test` feature
32-
# (exposes `dpdk::test_support::start_eal` and `dpdk::with_eal`).
23+
criterion = { workspace = true, features = ["cargo_bench_support"] }
3324
dpdk = { workspace = true, features = ["test"] }
34-
# Override match-action to also enable `bolero` for property-test
35-
# generators (`FieldHit` / `FieldMiss`).
3625
match-action = { workspace = true, features = ["derive", "bolero"] }
3726
net = { workspace = true, features = ["test_buffer", "builder"] }
27+
28+
[[bench]]
29+
name = "reference_five_tuple"
30+
harness = false
31+
32+
[[bench]]
33+
name = "dpdk_five_tuple"
34+
harness = false
35+
36+
[[bench]]
37+
name = "table_build"
38+
harness = false

0 commit comments

Comments
 (0)