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
Altering the set generation parameters produces interesting variations.
Benchmarks
How long does it takes to generate a 4000 pixel wide image?
- Pure Python (using PIL): 106 seconds
- Cython (using PIL): 4.27 seconds
- Cython (using C++ bindings to SFML): 3.21 seconds
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.