Klyn benchmark

Performance samples

Each Python / Klyn / C++ trio is executed three times. The displayed values are average wall-clock process times. The C++ column uses an executable compiled with g++ -O3 -std=c++20 -o <name> <name>.cpp.

Test Python Klyn --clean* Klyn C++ -O3
ComputePI
Computes 1500 digits of PI with a bounded-integer spigot algorithm.
1286.25 ms 138.30 ms9.30x faster than Python 44.81 ms28.71x faster than Python 26.83 ms47.95x faster than Python
Mandelbrot
Renders a 1000x700 Mandelbrot set to a binary PPM image.
1011.16 ms 169.85 ms5.95x faster than Python 59.98 ms16.86x faster than Python 32.08 ms31.52x faster than Python
Prime
Finds the first 400000 prime numbers with the Sieve of Eratosthenes.
1386.29 ms 116.70 ms11.88x faster than Python 56.64 ms24.47x faster than Python 16.20 ms85.59x faster than Python
* Klyn --clean removes the local cache before each execution. This column measures the worst startup scenario: rebuilding generated objects and then running the script. The Klyn column measures the normal cached startup path.

The benchmark source files are included in the Klyn distribution under samples/perf for curious users who want to inspect, run, or adapt them.