Skip to content

Add criterion benchmarks and live throughput bench script#3

Merged
lukekim merged 5 commits into
trunkfrom
feat/benchmarks
Mar 30, 2026
Merged

Add criterion benchmarks and live throughput bench script#3
lukekim merged 5 commits into
trunkfrom
feat/benchmarks

Conversation

@lukekim
Copy link
Copy Markdown
Contributor

@lukekim lukekim commented Mar 30, 2026

Summary

  • Add src/lib.rs to expose modules for external benchmarking
  • Criterion benchmarks (cargo bench): 21 benchmarks across crypto primitives and SMB protocol encoding/decoding
  • Live throughput script (make bench-live): single-file write/read at 1MB–1GB, multi-file writes, ~10GB total
  • Makefile targets: make bench, make bench-live

Test plan

  • cargo test passes (28 tests)
  • cargo bench runs all 21 benchmarks
  • make bench-live runs against NAS (requires SPICEIO_SMB_USER/PASS)

- Add lib.rs to expose modules for external benchmarking
- Criterion benchmarks for crypto (md4, sha256, hmac_md5, hmac_sha256,
  hex_encode) and protocol (header encode/decode, frame_packet,
  build_request, decode responses, parse_directory_entries, NtStatus)
- Live throughput script (scripts/bench-live.sh): single-file write/read
  at 1MB-1GB, multi-file writes, ~10GB total data volume
- Makefile targets: make bench, make bench-live
Copilot AI review requested due to automatic review settings March 30, 2026 20:07
@lukekim lukekim self-assigned this Mar 30, 2026
- Document fmt/clippy/rustdoc/test checks to run before creating PRs
- Add Default impls for MultipartStore and XmlWriter (clippy::new_without_default)
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR turns the project into a dual bin+lib crate to enable external benchmarking, and adds both Criterion-based microbenchmarks and a live throughput benchmarking script wired into the Makefile.

Changes:

  • Add src/lib.rs and a [lib] target so spiceio::{crypto,s3,smb} can be used from benches and external tooling.
  • Add Criterion benches for crypto primitives and SMB protocol encode/decode paths.
  • Add a bench-live script and Makefile targets for running micro + live throughput benchmarks.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/main.rs Switches from local mod declarations to importing modules from the new spiceio library crate.
src/lib.rs Introduces the library crate entrypoint exporting crypto, s3, and smb modules.
benches/crypto_bench.rs Adds Criterion benchmarks for crypto helpers exposed via the library crate.
benches/protocol_bench.rs Adds Criterion benchmarks for SMB protocol framing/encoding/decoding paths.
scripts/bench-live.sh Adds a live, end-to-end throughput benchmark runner against a locally started spiceio.
Makefile Adds bench and bench-live targets to run Criterion and the live script.
Cargo.toml Adds [lib], Criterion dev-dependency, and bench target configs.
Cargo.lock Updates lockfile to include Criterion and transitive dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile Outdated
Comment thread scripts/bench-live.sh Outdated
Comment thread scripts/bench-live.sh Outdated
Comment thread scripts/bench-live.sh Outdated
Comment thread scripts/bench-live.sh Outdated
Comment thread scripts/bench-live.sh Outdated
Comment thread scripts/bench-live.sh Outdated
Comment thread benches/protocol_bench.rs Outdated
Comment thread benches/protocol_bench.rs Outdated
lukekim added 2 commits March 30, 2026 13:16
- Add --locked to bench and bench-live build commands
- Use /dev/zero instead of /dev/urandom to avoid RNG bottleneck
- Remove unused human_size function
- Fix aggregate totals and use MiB units consistently
- Update script header with actual dependencies
- Pre-allocate buffers outside b.iter in protocol benchmarks
- Use typed enums (DesiredAccess, ShareAccess, etc.) instead of raw constants
Copilot AI review requested due to automatic review settings March 30, 2026 20:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread benches/crypto_bench.rs
Comment thread benches/protocol_bench.rs
Comment thread .github/workflows/ci.yml Outdated
- Wrap all benchmark return values in black_box to prevent elision
- CI: compile-check benchmarks (--no-run) instead of running them
@lukekim lukekim merged commit 9dc5609 into trunk Mar 30, 2026
3 checks passed
@lukekim lukekim deleted the feat/benchmarks branch March 30, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants