feat: add h5bench-equivalent Criterion benchmarks to clawhdf5-bench

Adds three Criterion benchmark suites mirroring the h5bench HPC I/O
benchmark workloads in pure Rust — no C libhdf5 required for the default
path, with an optional `libhdf5-compare` feature for side-by-side numbers.

  - benches/h5bench_write.rs: write_1d_contiguous, write_2d_chunked,
    write_f64_batch, write_multi_dataset, write_with_attrs
  - benches/h5bench_read.rs: read_sequential, read_f64_sequential,
    read_chunked_2d, read_from_disk, read_hyperslab
  - benches/h5bench_meta.rs: metadata_attrs_write, metadata_attrs_read,
    metadata_groups_create, metadata_groups_traverse, metadata_string_attrs

All benchmarks pass `cargo bench --bench <name> -- --test` and clippy
reports zero warnings.  Run with `cargo bench -p clawhdf5-bench`.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-30 11:41:41 +00:00
co-authored by Claude Sonnet 4.6
parent 28a0dc3384
commit 90bdd7cd13
4 changed files with 681 additions and 0 deletions
+27
View File
@@ -25,8 +25,35 @@ path = "src/bin/consolidation_efficiency.rs"
name = "ephemeral_perf"
path = "src/bin/ephemeral_perf.rs"
# ---------------------------------------------------------------------------
# h5bench-equivalent Criterion benchmarks
# ---------------------------------------------------------------------------
[[bench]]
name = "h5bench_write"
harness = false
[[bench]]
name = "h5bench_read"
harness = false
[[bench]]
name = "h5bench_meta"
harness = false
[dependencies]
clawhdf5-agent = { path = "../clawhdf5-agent" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tempfile = "3"
# Optional: libhdf5 C wrapper for side-by-side comparison (requires system libhdf5).
# Enable with: cargo bench -p clawhdf5-bench --features libhdf5-compare
hdf5 = { version = "0.8", optional = true }
[dev-dependencies]
clawhdf5 = { path = "../clawhdf5" }
criterion = { version = "0.5", features = ["html_reports"] }
[features]
# When enabled, benchmarks add matching libhdf5 variants for side-by-side comparison.
libhdf5-compare = ["hdf5"]