move comment regarding FutureMoves::by_depth
This commit is contained in:
parent
063ef47a27
commit
9fd3b45c0e
@ -151,12 +151,16 @@ impl FutureMoves {
|
||||
depth - 1
|
||||
}
|
||||
|
||||
//// PERF! pre-organize all indexes based on what depth they're at
|
||||
/// previously, I did a lookup map based on if a node was visited, still resulted in a full
|
||||
/// O(n) iteration each depth
|
||||
fn by_depth(&self, indexes: impl Iterator<Item = usize>) -> Vec<(usize, Vec<usize>)> {
|
||||
let mut by_depth: HashMap<
|
||||
usize,
|
||||
Vec<usize>,
|
||||
BuildHasherDefault<nohash_hasher::NoHashHasher<usize>>,
|
||||
> = HashMap::with_hasher(BuildHasherDefault::default());
|
||||
|
||||
for idx in indexes {
|
||||
let depth = self.depth_of(idx);
|
||||
if let Some(got) = by_depth.get_mut(&depth) {
|
||||
@ -173,9 +177,6 @@ impl FutureMoves {
|
||||
/// Compute `Move.value`, propegating upwards from the furthest out Moves
|
||||
/// in the Arena.
|
||||
fn compute_values(&mut self, indexes: impl Iterator<Item = usize>) {
|
||||
// PERF! pre-organize all indexes based on what depth they're at
|
||||
// previously, I did a lookup map based on if a node was visited, still resulted in a full
|
||||
// O(n) iteration each depth
|
||||
let by_depth_vec = self.by_depth(indexes);
|
||||
|
||||
// reversed so we build up the value of the closest (in time) moves from the future
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user