[Tutor] Cython vs Python-C API

Jaidev Deshpande deshpande.jaidev at gmail.com
Mon Nov 14 21:30:20 CET 2011


Hi

I need to perform cubic spline interpolation over a range of points, and I
have written the code for the same in C and in Python.

The interpolation is part of a bigger project. I want to front end for the
project to be Python. Ideally I want Python only to deal with data
visualization and i/o, and I'll leave the computationally expensive part of
the project to C extensions, which can be imported as functions into Python.

To this end, the interpolation can be handled in two ways:

1. I can either compile the C code into a module using the Python-C/C++
API, through which I can simple 'import' the required function.
2. I can use the Python code and extend it using Cython.

Which will give me a better performance?

Thanls
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111115/c6b44817/attachment.html>


More information about the Tutor mailing list