This is an implementation of Conway's Game of Life in F# using Bolero, which runs a compiled F# assembly entirely in Web Assembly. This is different from F# Fable which transpiles to Javascript.
There are no limitations on what portions of the library are available, rather any library can be used in Bolero, as evidenced by the use of Array2D
functions.
There is no HTML component; the entire Model-View-Update (MVU) application is written in Elmish in Main.fs
.
The model is immutable, so all updates are transformations. (most implementations which use double-buffering and array mutations).
Interop with the JS runtime seems to be expensive, while calculating the diff is not costly.
The internal state is a 2D array. Since model state in Elmish is never mutated, it must be recreated every time.
{ model with state = state |> Array2D.mapi(fun i j _ -> alive i j state |> rules) }
So enough memory pressure is generated to cause a GC.
This is a minor GC and very fast (less than 1ms).