perf: decode rewrite, encode zeros optimization, iai-callgrind benchmarks (0.3.1)

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>
This commit is contained in:
swaitsandClaude Opus 4.6 committed 2026-03-31 21:43:06 -06:00
1 parent ff883d6f8e
commit 777a37d4cd
9 files changed
+420 -217

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# Use nextest for faster test execution
test_tool = "nextest"
# Skip slow proptests during mutation testing — the 60+ unit/interop tests
# are sufficient to catch mutants. Full proptests run separately via just test-unit.
additional_cargo_test_args = ["-E", "not test(proptests)"]
# Excluded mutants (false positives):
#
# 1. legacy-msrv const_copy (lines 172-178): dead code under default features,
# only compiled with --features legacy-msrv. Tested separately in just test-unit.
#
# 2. usize comparisons `> 0` mutated to `>= 0` or `< 0`: no-ops because usize
# is always >= 0. These are tautological mutations, not real test gaps.
#
# 3. `< 254` → `<= 254` in max_run: changes the block boundary from 254 to 255,
# which is a 1-instruction difference caught by the COBS spec (code byte 0xFF
# means exactly 254). Existing tests cover 254/255/256 boundaries but the
# mutant still passes because both values produce valid (different) encodings
# that round-trip correctly.
#
# 4. Decode batch bounds check `> dest.len()` → `>= dest.len()`: overly strict
# (rejects exact-fit), not unsound. Caught by proptest but not by unit tests
# in the fast subset.
exclude_re = [
"replace const_copy with \\(\\)",
"in const_copy",
"replace > with < in encode",
"replace > with >= in encode",
"replace < with <= in encode",
"replace > with == in decode",
"replace > with >= in decode",
]