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

Travis Oliphant oliphant.travis at ieee.org
Sun Dec 3 01:09:44 EST 2006


> 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.
>   

The fastest interface is going to be hand-written.  Other than that, my 
experience shows that ctypes and pyrex (and weave) are comparable to 
each other (and not much slower than hand-written at that). 

All of my experience, however,  is on functions that do a reasonably 
large amount of work.

-Travis




More information about the SciPy-User mailing list