feat: add benchmarks, justfile, optimize throughput, harden quality gates
Benchmarking & comparison: - Add criterion benchmarks (ucobs vs cobs 0.3 vs corncobs 0.1) - Add Python cobs benchmark script - Add performance comparison section to README with full results Performance: - Rewrite encode to scan-and-bulk-copy via copy_from_slice - Rewrite decode to bulk-copy via copy_from_slice - ~2-4x throughput improvement; now matches corncobs on most workloads Quality hardening: - Add #![forbid(unsafe_code)], #![warn(missing_docs)], #[must_use] - Add [lints.rust] unsafe_code = "forbid" in Cargo.toml - Add rust-version (MSRV) = "1.56" - Add docs.rs metadata - 106 tests: 80 unit/corpus + 25 property tests (25k cases each = 625k total) - External test vectors from: Wikipedia, Cheshire & Baker paper, nanocobs, cobs-c, cobs2-rs, Jacques Fortier, Python cobs package - Add fuzz_small_dest fuzz target (encode/decode with undersized buffers) - Improve doc examples to show sentinel append/strip convention Infrastructure: - Add justfile with test (nextest), check, bench, fuzz, miri, fmt targets - cargo-nextest for parallel test execution - Update .gitignore for Python cache files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
10 files changed
+1187
-99
No files matched your search
@@ -0,0 +1,64 @@
|
||||
# μCOBS development tasks
|
||||
|
||||
# default: list all recipes
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# run ALL quality gates (tests, clippy, fmt check, doc, fuzz, miri)
|
||||
test: test-unit test-clippy test-fmt test-doc test-fuzz test-miri
|
||||
|
||||
# quick compile check (no tests)
|
||||
check:
|
||||
cargo check
|
||||
|
||||
# unit + integration + proptest tests (via nextest for parallelism)
|
||||
test-unit:
|
||||
cargo nextest run
|
||||
cargo test --doc
|
||||
|
||||
# clippy with all warnings as errors
|
||||
test-clippy:
|
||||
cargo clippy -- -D warnings
|
||||
|
||||
# check formatting
|
||||
test-fmt:
|
||||
cargo fmt -- --check
|
||||
|
||||
# doc build (catches broken doc links)
|
||||
test-doc:
|
||||
cargo doc --no-deps
|
||||
|
||||
# fuzz all targets (60s each, requires nightly + cargo-fuzz)
|
||||
test-fuzz:
|
||||
cd fuzz && cargo +nightly fuzz run fuzz_decode -- -max_total_time=60
|
||||
cd fuzz && cargo +nightly fuzz run fuzz_roundtrip -- -max_total_time=60
|
||||
cd fuzz && cargo +nightly fuzz run fuzz_small_dest -- -max_total_time=60
|
||||
|
||||
# run tests under miri (catches UB, requires nightly + miri component)
|
||||
# proptest is excluded — its file-persistence layer calls getcwd which miri does not support
|
||||
test-miri:
|
||||
cargo +nightly miri test -- --skip proptests
|
||||
|
||||
# run criterion benchmarks (ucobs vs cobs vs corncobs)
|
||||
bench:
|
||||
cargo bench
|
||||
|
||||
# run python cobs benchmarks (requires: pip install cobs)
|
||||
bench-python:
|
||||
python3 bench_python.py
|
||||
|
||||
# run all benchmarks (rust + python)
|
||||
bench-all: bench bench-python
|
||||
|
||||
# format code
|
||||
fmt:
|
||||
cargo fmt
|
||||
|
||||
# build in release mode
|
||||
build:
|
||||
cargo build --release
|
||||
|
||||
# clean all build artifacts
|
||||
clean:
|
||||
cargo clean
|
||||
rm -rf fuzz/target fuzz/corpus fuzz/artifacts
|
||||
Reference in new issue
Block a user