[SciPy-user] Fastest python extension for tiny functions?

Anand Patil anand at soe.ucsc.edu
Sat Dec 2 14:53:32 CST 2006


Hi all,

I have some very light functions that get called enormous numbers of 
times. I'd like to get them running as fast as possible, even if it 
makes them ugly. The functions do several integer comparisons but no 
floating-point computation, so I'd like to port them to C/C++ rather 
than Fortran.

While weave.inline has been rocking my world for most applications, on 
my computer the gateway alone seems to take about 1s per 100k calls, 
which is quite a bit of overhead for functions this small. Could anyone 
help me figure out which python-to-C method (swig, boost::python, etc) 
is fastest for tiny functions? I know ahead of time what types all the 
arguments will be.

Thanks very much as always,
Anand


More information about the SciPy-user mailing list