Open uselessgoddess opened 2 years ago
par_each_iter_impl
might look something like this:
fn par_each_iter_impl(..., buf) {
if magic_appropriate_to_join(...) {
let mid-cnt = count(left(...)); // mid-cnt + right-cnt == cnt
rayon::join(
|| par_each_impl(..., buf[..mid-cnt]),
|| par_each_impl(..., buf[mid-cnt..]),
)
} else {
seq_each_iter_impl(..., buf)
}
}
fn par_each_iter(...) {
let mut buf = with_capacity(count(...));
par_each_impl_iter(buf[...])
}
You can start with this example