About

This was an experiment with Cython, a Python-style compiled language. The same Mandelbrot set generator was written in three different ways and tested for speed.

Images

Black and white

Shaded

Edge

Altering the set generation parameters produces interesting variations.

Distorted image 1

Distorted image 2

Benchmarks

How long does it takes to generate a 4000 pixel wide image?

The speed ratios were similar across a range of sizes.

Switching to Cython produced a 25x speed-up, and using Cython to interface directly with C++ libraries improved performance by another 25% (although this could be due to differences between PIL and SFML).

Download

Source (zip file, 45 KB)

This includes code for all three variations, a makefile, and a benchmarking script.

It requires Cython, SFML, and PIL.