updated 2026-11-26·4 min read
Verification Latency & Memory Benchmarks
What Cloudflame's Criterion suites and the Stokes test harness actually measured, without extrapolated CLI numbers.
There are two completely different things people lump together under “benchmarks” here: how fast the Python CLI checks a repo, and how fast the Rust cloudflame-proxy testbed processes packet descriptors.
I didn’t build a Criterion harness around a 50k LOC Python CLI run, and pretending otherwise would be fake. What is verified in the repo is simpler: the CLI skips Docker and full compiler invocations (rustc, mypy), so local checks finish quickly, while the actual Criterion numbers live inside the Rust cloudflame-proxy crate.

What Criterion Actually Measured (cloudflame-proxy)
Two sets of Rust Criterion measurements sit in the repo, and they measure two different slices of the intake path:
- 16-Item Slice Partitioning (
ingest_benchmark.rs):in_place_select_nth_boundary_16partitions a 16-item stack window withselect_nth_unstable_byin7.66 ns(0 Bheap), versus29.74 nsforheap_allocated_vec_boundary_16(Vec::with_capacity+sort_by+truncate).stokes/harness/criterion_runner.pyalso stores7.66and29.74as its offline reference constants when Criterion JSON files aren’t on disk. - Full-Struct Deserialization (
CONFORMANCE.md): Before adding Dual-Zone in-place partitioning, bounded stack deserialization on the full struct measured213.09 nsversus134.19 nsfor heapVec<Feature>reallocation (0.6xfaster, i.e., actually slower on raw deserialization speed, trading raw throughput for0 Bheap allocation).
| Benchmark Case | Source | Stack / In-Place | Heap Vec Baseline | What It Measures |
|---|---|---|---|---|
in_place_select_nth_boundary_16 | ingest_benchmark.rs | 7.66 ns (0 B heap) | 29.74 ns | Partitioning a 16-item L1-resident window (select_nth_unstable_by) |
| Bounded Stack Deserialization | CONFORMANCE.md | 213.09 ns (0 B heap) | 134.19 ns | Full struct deserialization (0.6x slower than heap, zero allocs) |
Test Harness & Fuzz Measurements
Why Zero Heap Allocation Matters at the L7 Edge
- L1D Cache Line Residency
FeatureDescriptor is 8 bytes (repr(C, align(8))). 200 descriptors occupy 1,600 bytes across 25 contiguous 64-byte cache lines (4.8% of a 32 KB L1D cache) without pointer indirection.
- Dual-Zone In-Place Partitioning
Downstream proxies pin 128 core rules in Zone 0 (priority >= 200) and partition 72 adaptive slots in Zone 1 via select_nth_unstable_by with 0 B heap overhead.
- 10,000-Case Float Fuzz Battery
float_fuzz_battery.py sweeps 10,000 randomized 32-bit patterns plus adversarial NaNs, infinities, and subnormals to verify fail-secure clamping to 100.0.
- Normalized Semantic AST Lockfile
stokes.lock hashes canonical schema signatures, skipping comments and formatting while catching real cardinality drift.
ingest_benchmark.rs (16-Item & 200-Item Criterion Functions)
// cloudflame/crates/cloudflame-proxy/benches/ingest_benchmark.rs
group.bench_function("in_place_select_nth_boundary_16", |b| {
let mut window = [FeatureDescriptor::new(0, 0, false); 16];
window.copy_from_slice(&sample[184..200]);
b.iter(|| {
window.select_nth_unstable_by(7, |a, b| b.priority.cmp(&a.priority));
black_box(&window[..8]);
});
});
group.bench_function("heap_allocated_vec_boundary_16", |b| {
b.iter(|| {
let mut heap_vec: Vec<FeatureDescriptor> = Vec::with_capacity(16);
heap_vec.extend_from_slice(&sample[184..200]);
heap_vec.sort_by(|a, b| b.priority.cmp(&a.priority));
heap_vec.truncate(8);
black_box(heap_vec);
});
});Benchmarking & Memory FAQ
- Why not print a per-phase millisecond table for the CLI? Because I didn’t run a formal multi-phase profiler on a 50k LOC monorepo, and guessing sub-millisecond phase splits would be meaningless. Skipping Docker and
rustcis why the CLI feels instant locally. - Why does
7.66 nsonly cover 16 items? That is whatin_place_select_nth_boundary_16iningest_benchmark.rsactually benchmarks; full-struct deserialization inCONFORMANCE.mdran at213.09 ns. - Why does 32 KB L1D cache residency matter? Keeping the 1,600-byte descriptor array inside 25 contiguous 64-byte cache lines avoids pointer chasing on packet intake.
- What does the 10,000-case float fuzz battery verify? Adversarial IEEE-754 floats, subnormals, quiet and signaling NaNs, and infinities against
sanitize_signal_float.
See Verification, Fuzzing & Simulation Harness and Cloudflame Case Study for the full incident setup.