Skip to main content

Mandelbrot Set with AssemblyScript / WebAssembly

Plotting the Mandelbrot set with AssemblyScript, a TypeScript-like language that compiles to WebAssembly bytecode.

I’ve translated the code I wrote for plotting the Mandelbrot set with p5.js to AssemblyScript, to get a feel for it.

Mandelbrot set with an escape radius of 2.0, a maximum of 40 iterations, 8 extra iterations for quick escapes, and a palette of 2048 colors.

I measured rendering times on my device, with a 2560x1280 canvas, and got the following results:

Chromium 100Firefox 98Safari 15.4
p5.js546 ms788 ms809 ms
AssemblyScript241 ms175 ms241 ms

Also, the .wasm file is only 555 B!

Resources

See also