Repository navigation
perf(liburing): add criterion 0.8.2 benches, hierarchical state machines, and hot-path optimizations - #17
Merged
Conversation
…nes, and hot-path optimizations
trunkszi
force-pushed
the
perf/criterion-hsm-hotpath
branch
from
October 27, 2026 16:15
4998125 to
b3c0b08
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a Criterion 0.8.2 hot-path benchmark suite with zero-allocation pre-flight gates across
liburing-rs, refactorOperationSlabandCompletionSocketTableslot state into compact#[repr(u8)]Hierarchical State Machines (OperationPhaseandSocketSlotPhase), and packOperationSlabslot metadata to improve submission and completion hot-path latency.criterion = { version = "0.8.2", default-features = false, features = ["cargo_bench_support"] }in root[workspace.dependencies]and inherit viacriterion = { workspace = true }incrates/liburing/Cargo.toml, withbench = falseunder[lib].crates/liburing/benches/uring_hotpath_bench.rscovering single-shot, multishot, zero-copy, and cancellationOperationSlablifecycles,OperationIdpayload bit-packing,FixedBufferRegistrylease/release,FixedFileSetlease/release,CompletionSocketTableclose transitions, and real kernelio_uringNOPsubmit/wait dispatch, with aCountingAllocatorzero-allocation pre-flight check outside the timedb.iter()loop.#[repr(u8)]) & Slot Packing:OperationState+ 3 sidecar booleans (multishot,zero_copy,zero_copy_notified) incrates/liburing/src/operation_slab.rswith a single 1-byte#[repr(u8)]OperationPhasewhose low 2 bits encodeOperationStatedirectly (state()is a single bitmask + projection,size_of::<OperationPhase>() == 1).u32alongsidegeneration: u32in#[repr(C)] struct Slot<Meta>and flatten steady-state completion, cancellation, and zero-copy notification transitions.#[repr(u8)]SocketSlotPhase(Closed,Active,ClosingPending,size_of::<SocketSlotPhase>() == 1) incrates/liburing/src/socket_io.rs.IdentityMaplinear-scan fast path for small tables (<= 8entries) incrates/liburing/src/identity_map.rswhile keepingIdentityMapcrate-private (pub(crate)).Evidence
Before vs. After Criterion Benchmarks (
origin/main@8155225vs. Branch, Pinned Interleaved A/B on Core 29)origin/mainMeanoperation_slab/zero_copy2.71 ns2.15 ns-20.7%)0 B / 0 allocsoperation_slab/single1.84 ns1.57 ns-14.3%)0 B / 0 allocsoperation_slab/cancel2.17 ns2.01 ns-7.4%)0 B / 0 allocsoperation_slab/multishot2.15 ns2.11 ns-1.9%)0 B / 0 allocsoperation_id/payload_pack605.77 ps517.50 ps-14.6%)0 B / 0 allocsproactor/submit_dispatch_nop165.36 ns163.44 ns-1.2%)0 B / 0 allocsfixed_file/lease_release260.05 ns252.42 ns-2.9%)0 B / 0 allocsfixed_buffer/lease_release19.86 ns19.96 ns~1.00x0 B / 0 allocsVerification Gates
cargo fmt --all -- --check— PASScargo clippy --workspace --all-targets -- -D warnings— PASScargo test --workspace— PASS (129 passed, 0 failed)cargo bench --workspace --no-run— PASS.rsfile length across modified/added files:786lines (crates/liburing/src/operation_slab.rs,<= 800limit).Merge Danger
OperationState,OperationSlab,CompletionSocketTable,FixedBufferRegistry, andFixedFileSetAPIs preserve full backward compatibility;IdentityMapandOperationPhaseremain private to the crate.crates/liburing/src/{fixed_buffers.rs, identity_map.rs, operation_slab.rs, socket_io.rs}and the new Criterion benchmark suite incrates/liburing/benches/uring_hotpath_bench.rs.