On Wed, May 13, 2009 at 1:31 PM, Chris Colbert <[email protected]> wrote: > What follows is my 0.02, and i'm really new at these two libs so keep in > mind I could be completely off base. I'm sure someone will jump in and > correct my errors. > > I think the speed is really going to depend on the nature of your calls into > the c library. From the code i've examined, there will probably be more > overhead for the function call when using ctypes vs cython, but cython > generated source code is somewhat less than maintainable and I would wager > also less optimized than something you would write yourself. > > If your making lots of rapid calls to short running functions in the > C-library, then you may start to feel the ctypes overhead.
That's my experience as well: ctypes overhead is quite noticeable. For my own usage (wrapping C api), I think cython is better, and I stopped using ctypes entirely for that usage. But ctypes still shines when you want to try things with some C libraries, as you can do everything from python (no cython/compile cycle). David _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
