Carlo Hamalainen


Speeding up code using Cython

2007-12-18

The graph below compares a brute-force depth first search in Sage/Python (red line) to an implementation of the same algorithm in Cython (blue line). Vertical axis is run time in seconds, horizontal axis is number of latin square completions generated:

Cython does pretty well, and the code is far more readable than the earlier C++ version that I wrote.

For more about writing Cython code in Sage, see Chapter 5 of the documentation.