Repository navigation
v0.4.4
Fixed
Fingerprints are now bit-identical on every CPU. Output depended on the
target's floating-point code path, so the same audio could produce different
Haitsma frames on aarch64 (Apple silicon, Graviton), on x86_64 builds with FMA
enabled (target-cpu=native, x86-64-v3), or in any application whose
dependency graph enabled rustfft's SIMD features. Spectra differed in their
low bits in every case, resampled audio in all but the rustfft one; Wang and
Panako hashes absorbed the differences on the test corpus, Haitsma's did not.
The fingerprint goldens missed this because they check only final hashes on
one configuration.
Files identical to baseline x86_64 on the 47-file test corpus before the fix
(Wang and Panako were 47/47 throughout). After the fix, every configuration
is 47/47 on every stage and every offline and streaming output.
| Configuration | Resampled audio | Spectra | Haitsma |
|---|---|---|---|
| aarch64 (NEON) | ≤ 1/47 | 0/47 | 46/47 |
x86_64, -C target-cpu=x86-64-v3 (FMA, AVX2) |
≤ 1/47 | 0/47 | 45/47 |
x86_64, -C target-cpu=native on an AVX-512 host |
≤ 1/47 | 0/47 | 45/47 |
| rustfft SIMD features enabled in the dependency graph | 47/47 | 0/47 | 44/47 |
Causes, each removed:
wide'smul_addrounds once on NEON and FMA-enabled x86 and twice
elsewhere. The dot-product, sum-of-squares, and complex-power kernels now
multiply and add separately.wide's horizontal sum pairs lanes differently on AVX. Lanes are now
summed in a fixed order.wide'sf32x8::log2evaluates its polynomial withmul_add(its docs
call the precision platform-dependent). The dB conversion now uses an
FMA-free port that matcheswide's baseline-x86_64 output for all 2³²
inputs.realfftplans through rustfft'sFftPlanner::new(), which picks an
AVX/SSE/NEON FFT at runtime whenever rustfft's SIMD features are on — and
any crate in the graph can turn them on. The STFT now uses rustfft's
scalar planner through an in-crate port of realfft's real-to-complex step;
realfftis no longer a dependency.- Scalar
log2andexp, and the FFT twiddle factors, came from the
platform C library. They now come fromlibm.
Baseline x86_64 output is unchanged: every intermediate stage and fingerprint
is bit-identical to before and the goldens pass unmodified. Fingerprints
computed on the other configurations can differ from earlier releases in
isolated bits (on the corpus, 1 of 67,460 Haitsma frames on aarch64).
calibrated_* probabilities move by at most 2 ULP (94 of 3,003 sampled
values on x86_64 Linux). tests/cross_platform_determinism.rs pins the
resampler, STFT, and mel outputs; it runs on the macOS (aarch64) CI runners
and in a new x86-64-v3 CI job.
32-bit targets compile again. The compact index postings below failed to
build for wasm32 and 32-bit ARM: a layout assertion assumed 64-bit pointers.
CI now checks both targets.
Performance
Faster Wang/Panako extraction and streaming, far lower peak memory for
offline extraction, and smaller 1:N indexes. The optimisations leave hash
output unchanged — bit-identical to 0.4.3 on the golden corpus, 7
real-audio files, and randomized spectra, offline and streaming (legacy
flush and flush_complete). No public API changes.
Speed: cargo bench medians, same machine (Intel i5-1135G7) and settings
before and after. Haitsma's code path is untouched, so its rows are a
control for run-to-run noise.
Extraction
| Benchmark | Before | After | Change |
|---|---|---|---|
wang/extract/2s |
4.17 ms | 1.46 ms | −65 % (2.86×) |
wang/extract/5s |
10.30 ms | 3.75 ms | −64 % (2.75×) |
wang/extract/30s |
66.60 ms | 22.80 ms | −66 % (2.92×) |
panako/extract/2s |
4.24 ms | 1.51 ms | −65 % (2.82×) |
panako/extract/5s |
10.52 ms | 4.01 ms | −62 % (2.62×) |
panako/extract/30s |
68.90 ms | 25.78 ms | −63 % (2.67×) |
haitsma/extract/30s (control) |
42.02 ms | 40.35 ms | −4 % (noise) |
Streaming (10 s of audio per session)
| Benchmark | Before | After | Change |
|---|---|---|---|
streaming/wang/push_flush_session/small_chunk_256 |
9.02 ms | 3.97 ms | −56 % (2.27×) |
streaming/wang/push_flush_session/large_chunk_1s |
8.94 ms | 3.88 ms | −57 % (2.30×) |
streaming/wang/push_with_callback_warmed/small_chunk_256 |
57.3 µs | 24.1 µs | −58 % (2.38×) |
streaming/panako/push_flush_session/small_chunk_256 |
9.42 ms | 4.25 ms | −55 % (2.22×) |
streaming/panako/push_flush_session/large_chunk_1s |
9.24 ms | 4.19 ms | −55 % (2.20×) |
streaming/panako/push_with_callback_warmed/small_chunk_256 |
57.8 µs | 24.7 µs | −57 % (2.34×) |
streaming/haitsma/push_flush_session/small_chunk_256 (control) |
6.50 ms | 6.33 ms | −3 % (noise) |
Matching (1:N index)
| Benchmark | Before | After | Change |
|---|---|---|---|
matching/wang_index/n100_query |
76.2 µs | 69.9 µs | −8 % |
matching/wang_index_insert/insert_one_into_n100 |
114.0 µs | 105.0 µs | −8 % |
matching/wang_index_insert/rebuild_n101 |
13.12 ms | 10.23 ms | −22 % |
1:1 matchers (WangMatcher, PanakoMatcher, HaitsmaMatcher) are
unchanged, within ±2 %.
Memory
Measured with a counting global allocator on synthetic music.
| Workload | Before | After | Change |
|---|---|---|---|
Wang / Panako offline extract, 30 s — peak heap |
11.6 MB | 0.27 MB | −98 % |
Wang / Panako offline extract, 5 min — peak heap |
116.2 MB | 0.81 MB | −99 % |
WangIndex, 300 tracks × 20 s — live heap |
56.9 MB | 37.0 MB | −35 % |
WangIndex, 300 tracks × 20 s — allocations in build |
695 100 | 146 905 | −79 % |
WangIndex, 1 000 tracks × 20 s — live heap |
121.7 MB | 87.5 MB | −28 % |
PanakoIndex, 300 tracks × 20 s — live heap |
67.2 MB | 38.5 MB | −43 % |
What changed
- Peak picking (
dsp::peaks): the 2-D rolling max runs the horizontal
pass by doubling over a NaN-padded row and the vertical pass as a
streaming van Herk / Gil-Werman block max, with an 8-wide bitmask
candidate scan. Both are exact, so peaks are identical.
IncrementalPeakDetectoruses the same kernels and still allocates
nothing after construction. - Offline Wang/Panako front-end: computes, converts, and peak-picks
one STFT frame at a time instead of materialising the spectrogram. The
dB conversion reproduces the previous whole-buffer SIMD/scalar rounding
split exactly. - Index postings:
WangIndex,HaitsmaIndex, andPanakoIndexstore
single-posting keys (82–85 % of keys on measured catalogs) inline in the
map slot instead of in a separate heap allocation.
Notes
The STFT always runs rustfft's scalar FFT. rustfft's SIMD backends are faster
(AVX2 host, synthetic music, harness medians):
| Workload (30 s of audio) | Scalar FFT (used) | SIMD FFT (not used) |
|---|---|---|
Wang extract |
21.0 ms | 14.1 ms |
Panako extract |
23.3 ms | 16.6 ms |
Haitsma extract |
35.0 ms | 14.8 ms |
but rustfft selects them per CPU at runtime and they do not round like the
scalar code or like each other, so fingerprints would depend on the machine.
Enabling rustfft's avx/sse/neon features no longer affects this crate.