| ▲ | jvuygbbkuurx 5 hours ago | |||||||
Does this solution copy the state on each iteration? | ||||||||
| ▲ | WJW 4 hours ago | parent [-] | |||||||
Haskell values are immutable, so it creates a new state on each iteration. Since most of these "game of life" type problems need to touch every cell in the simulation multiple times anyway, building a new value is not really that much more expensive than mutating in place. The Haskell GC is heavily optimized for quickly allocating and collecting short-lived objects anyway. But yeah, if you're looking to solve the puzzle in under a microsecond you probably want something like Rust or C and keep all the data in L1 cache like some people do. If solving it in under a millisecond is still good enough, Haskell is fine. | ||||||||
| ||||||||