Refrain from parallelizing insertion in the top layer

This commit is contained in:
Dirkjan Ochtman 2021-05-20 15:34:28 +02:00
parent 6fda656afb
commit bdc0a51e10
1 changed files with 11 additions and 4 deletions

View File

@ -314,10 +314,17 @@ where
} }
let end = range.end; let end = range.end;
if layer == top {
nodes[range].into_iter().for_each(|(_, pid)| {
let node = state.zero[*pid].write();
state.insert(*pid, node, layer, &layers);
})
} else {
nodes[range].into_par_iter().for_each(|(_, pid)| { nodes[range].into_par_iter().for_each(|(_, pid)| {
let node = state.zero[*pid].write(); let node = state.zero[*pid].write();
state.insert(*pid, node, layer, &layers); state.insert(*pid, node, layer, &layers);
}); });
}
// For layers above the zero layer, make a copy of the current state of the zero layer // For layers above the zero layer, make a copy of the current state of the zero layer
// with `nearest` truncated to `M` elements. // with `nearest` truncated to `M` elements.