diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs index ee20841f..e2a40d77 100644 --- a/plugins/diopser/src/lib.rs +++ b/plugins/diopser/src/lib.rs @@ -250,9 +250,10 @@ impl Plugin for Diopser { // We get better cache locality by iterating over the filters and then over the channels for filter_idx in 0..self.params.filter_stages.value as usize { - // Because of this filter_idx outer loop we can't directly iterate over - // `channel_samples` as the iterator would be empty after the first loop for (channel_idx, filters) in self.filters.iter_mut().enumerate() { + // We can also use `channel_samples.iter_mut()`, but the compiler isn't able to + // optmize that iterator away and it would add a ton of overhead over indexing + // the buffer directly let sample = unsafe { channel_samples.get_unchecked_mut(channel_idx) }; *sample = filters[filter_idx].process(*sample); }