ctype performance benchmark

Stefan Behnel stefan_ml at behnel.de
Fri Jul 17 10:35:54 CEST 2009


aurora00 at gmail.com wrote:
> My overall observation is that ctypes function has an overhead that is
> 2 to 3 times to a similar C extension function. This may become a
> limiting factor if the function calls are fine grained. Using ctypes
> for performance enhancement is a lot more productive if the interface
> can be made to medium or coarse grained.

I think ctypes is ok for its niche: easy interfacing with C stuff from
straight Python code, without further dependencies. There will always (and
necessarily) be a call overhead involved. Anyone who needs to care about
per-call performance would use something else anyway (do I need to mention
Cython here?)

Stefan



More information about the Python-list mailing list