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.js546ms788ms809ms
AssemblyScript241ms175ms241ms

Also, the .wasm file is only 555B!

Resources

See also