Optimize 2020/17

that early exit makes it almost an order of magnitude faster
This commit is contained in:
kageru 2020-12-17 15:45:30 +01:00
parent eef4aa7643
commit d29e481a24
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

View File

@ -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);