From 7582fbeb656d5a111a00107faa6f007dd6fa0110 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 25 Nov 2026 08:42:06 -0800 Subject: [PATCH] audio-dsp: drop the allocation-counter dev-dependency and its tests/it test The tests/it binary held only the no-allocation test, which replaced the global allocator with allocation-counter. Both are removed, along with the Cargo.lock entries the dev-dependency added. --- Cargo.lock | 9 ------- crates/audio-dsp/Cargo.toml | 4 --- crates/audio-dsp/tests/it/main.rs | 3 --- crates/audio-dsp/tests/it/no_alloc.rs | 38 --------------------------- 4 files changed, 54 deletions(-) delete mode 100644 crates/audio-dsp/tests/it/main.rs delete mode 100644 crates/audio-dsp/tests/it/no_alloc.rs diff --git a/Cargo.lock b/Cargo.lock index 94db21da53..c5c4f529a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,12 +180,6 @@ dependencies = [ "alloc-no-stdlib 3.0.0", ] -[[package]] -name = "allocation-counter" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb9e990c0a33699f1984d85a6abead615ccc72dd8130bf3e15dcabe2ca149c9" - [[package]] name = "allocator-api2" version = "0.2.21" @@ -1643,9 +1637,6 @@ dependencies = [ [[package]] name = "craft-audio-dsp" version = "0.1.0" -dependencies = [ - "allocation-counter", -] [[package]] name = "craft-ber" diff --git a/crates/audio-dsp/Cargo.toml b/crates/audio-dsp/Cargo.toml index 7f3fd359a5..5d192e9d31 100644 --- a/crates/audio-dsp/Cargo.toml +++ b/crates/audio-dsp/Cargo.toml @@ -12,7 +12,3 @@ workspace = true # No dependencies: planar `&mut [f32]` slices in, planar slices out. [dependencies] - -[dev-dependencies] -# Counts heap allocations in tests/it, the one test binary it replaces the global allocator in. -allocation-counter = "0.8" diff --git a/crates/audio-dsp/tests/it/main.rs b/crates/audio-dsp/tests/it/main.rs deleted file mode 100644 index 1ab45f4b14..0000000000 --- a/crates/audio-dsp/tests/it/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -//! Integration tests of craft-audio-dsp. - -mod no_alloc; diff --git a/crates/audio-dsp/tests/it/no_alloc.rs b/crates/audio-dsp/tests/it/no_alloc.rs deleted file mode 100644 index ee1b3a19cb..0000000000 --- a/crates/audio-dsp/tests/it/no_alloc.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! Processing, parameter changes and resets do not allocate. - -use craft_audio_dsp::create_effect; - -/// The voice pitch shifter runs a voiced tone through 10,000 blocks of 480 frames, with its -/// pitch, its fine tune and a return to no shift changed between blocks, and a reset, without one -/// heap allocation. -#[test] -fn voice_pitch_does_not_allocate_while_processing() { - let Some(mut fx) = create_effect("voice_pitch", 48_000.0, 2) else { panic!("voice_pitch is not registered") }; - let tone: Vec = (0..480).map(|i| (0.4 * (std::f64::consts::TAU * 150.0 * i as f64 / 48_000.0).sin()) as f32).collect(); - let (mut l, mut r) = (tone.clone(), tone.clone()); - let info = allocation_counter::measure(|| { - for block in 0..10_000u32 { - match block % 500 { - 0 => { - fx.set_param("semitones", (block / 500 % 7) as f32 * 4.0 - 12.0); - } - 250 => { - fx.set_param("cents", -35.0); - } - 499 => { - fx.set_param("semitones", 0.0); - fx.set_param("cents", 0.0); - } - _ => {} - } - if block == 7_777 { - fx.reset(); - } - l.copy_from_slice(&tone); - r.copy_from_slice(&tone); - fx.process(&mut [&mut l, &mut r]); - } - }); - assert_eq!(info.count_total, 0, "{info:?}"); - assert!(l.iter().chain(&r).all(|v| v.is_finite())); -}