Using C in IPython with Cython

Distributing independent tasks across several cores is the easiest way to take advantage of the parallel capabilities of modern computers, thereby reducing the total execution time twofold or more. However, some algorithms cannot be easily split into independent subtasks. In addition, it may happen that the algorithm itself is far too slow in Python because it involves nested loops that cannot be vectorized. In this situation, a very interesting option could be to code a small but critical section of the code in C so as to considerably reduce the Python overhead. This solution does not involve any parallel computing feature, but it still allows to considerably improve the efficiency of a Python script. Additionally, ...

Get Learning IPython for Interactive Computing and Data Visualization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.