Skip to content

Commit 4d179b0

Browse files
committed
Make HRTF benchmark less heavy by rendering less samples
1 parent caae961 commit 4d179b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

benches/my_benchmark.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::sync::OnceLock;
1515
const SAMPLE_RATE: f32 = 48000.;
1616
const DURATION: usize = 10;
1717
const SAMPLES: usize = SAMPLE_RATE as usize * DURATION;
18+
const SAMPLES_SHORT: usize = SAMPLE_RATE as usize; // only 1 second for heavy benchmarks
1819

1920
/// Load an audio buffer and cache the result
2021
///
@@ -220,7 +221,7 @@ pub fn bench_analyser_node() {
220221
}
221222

222223
pub fn bench_hrtf_panners() {
223-
let ctx = OfflineAudioContext::new(2, black_box(SAMPLES), SAMPLE_RATE);
224+
let ctx = OfflineAudioContext::new(2, black_box(SAMPLES_SHORT), SAMPLE_RATE);
224225

225226
let mut panner1 = ctx.create_panner();
226227
panner1.set_panning_model(PanningModelType::HRTF);
@@ -237,7 +238,7 @@ pub fn bench_hrtf_panners() {
237238
osc.connect(&panner2);
238239
osc.start();
239240

240-
assert_eq!(ctx.start_rendering_sync().length(), SAMPLES);
241+
assert_eq!(ctx.start_rendering_sync().length(), SAMPLES_SHORT);
241242
}
242243

243244
#[cfg(feature = "iai")]

0 commit comments

Comments
 (0)