Explain not using the inner iterator in Diopser
This commit is contained in:
parent
24f81e2542
commit
fc8aec5afa
|
@ -250,9 +250,10 @@ impl Plugin for Diopser {
|
||||||
|
|
||||||
// We get better cache locality by iterating over the filters and then over the channels
|
// 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 {
|
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() {
|
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) };
|
let sample = unsafe { channel_samples.get_unchecked_mut(channel_idx) };
|
||||||
*sample = filters[filter_idx].process(*sample);
|
*sample = filters[filter_idx].process(*sample);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue