Optimize 2020/17
that early exit makes it almost an order of magnitude faster
This commit is contained in:
parent
eef4aa7643
commit
d29e481a24
|
@ -24,6 +24,7 @@ fn make_step<P: Position>(input: Grid<P, Cell>) -> Grid<P, Cell> {
|
|||
input
|
||||
.fields
|
||||
.keys()
|
||||
.filter(|&&p| readonly.get(p) == Cell::Alive)
|
||||
.flat_map(|p| p.neighbors())
|
||||
.map(|pos| {
|
||||
let cell = readonly.get(pos);
|
||||
|
|
Loading…
Reference in New Issue
Block a user