Decode rewritten with shrinking-slice pattern (split_first/split_at) instead of index arithmetic. Decode zeros 14% faster, decode nonzero flips from 5% behind corncobs to 2% ahead, decode mixed closes to tied. Encode zeros fast path moved before split_at — now tied with cobs (was 6% behind). Code size reduced to 821B (was 869B). Replaced criterion with iai-callgrind for deterministic instruction-count benchmarks via Valgrind. Zero run-to-run variance. Expanded to 162 benchmarks across 9 sizes. ucobs now wins or ties 16 of 18 benchmarks vs corncobs and cobs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
81 lines
2.2 KiB
Makefile
81 lines
2.2 KiB
Makefile
# μCOBS development tasks
|
|
|
|
# default: list all recipes
|
|
default:
|
|
@just --list
|
|
|
|
# run ALL quality gates (tests, clippy, fmt check, doc, fuzz, miri, mutants)
|
|
test: test-unit test-clippy test-fmt test-doc test-fuzz test-miri test-mutants
|
|
|
|
# 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
|
|
|
|
# mutation testing (requires cargo-mutants)
|
|
test-mutants:
|
|
cargo mutants --no-shuffle
|
|
|
|
# run iai-callgrind benchmarks (deterministic instruction counts, requires valgrind)
|
|
bench: bench-iai bench-size
|
|
|
|
# run iai-callgrind benchmarks (ucobs vs cobs vs corncobs)
|
|
bench-iai:
|
|
cargo bench
|
|
|
|
# measure compiled code size (encode + decode .text bytes)
|
|
bench-size:
|
|
@cargo build --release 2>/dev/null
|
|
@echo ""
|
|
@echo "Code size (release, encode + decode .text):"
|
|
@nm -S target/release/libucobs.rlib 2>/dev/null \
|
|
| grep 'T _ZN5ucobs' \
|
|
| awk '{size=strtonum("0x"$2); name=$4; sub(/.*ucobs[0-9]*/, "", name); sub(/17h.*/, "", name); printf " ucobs %-7s %4d B\n", name, size}'
|
|
|
|
# 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
|