Vincent Costel

Game of Life in AssemblyScript

AssemblyScript is a strict variant of TypeScript that compiles to WebAssembly.

I wanted to try the language, so I ported my implementation of the Game of Life to it.
At first I did a straight port, changing as little code as possible. Then I noticed my implementation used significantly more resources than the Game of Life example provided in the docs. I realized that my way of writing pixel data to the canvas was very inefficient and learned how to use ImageData instead.

But this performance improvement was done outside the WebAssembly program. Does the code run faster in WebAssembly? I don't know. I don't think it really matters for such a trivial program.

That's it. The code is on GitHub