I should also state, that its a helluva lot easier to get something up and
running using cython vs ctypes. So if your not doing application programming
intented for distribution, my vote goes to Cython.

I can write my whole script and have it execute to completion using Cython,
before i'm even done compiling a C dll.

Chris

On Wed, May 13, 2009 at 12:31 AM, Chris Colbert <sccolb...@gmail.com> 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.
>
> Chris
>   On Tue, May 12, 2009 at 11:48 PM, Mohamed Lrhazi <lrh...@gmail.com>wrote:
>
>> Hello,
>>
>> How fast/slow is using ctypes to talk to a C lib, compared to doing it
>> directly form Cython?
>>
>> While debugging an issue using ctypes, I found myself writing code
>> that was mixing the two methods... the Cython module was passing a
>> pointer to my Python code, which then uses ctypes functions to talk
>> the C lib, passing the pointer along the way, and it seems to work
>> fine... So, my question is, when I have the option to do some
>> interaction with the C lib in Cython or in ctypes, which should I go
>> with?
>>
>> ctypes is more pythonic with its Structures concepts.. but is it
>> really slow? would I gain from doing it the harder way, in Cython?
>>
>> Thanks a lot,
>> Mohamed.
>> _______________________________________________
>> Cython-dev mailing list
>> Cython-dev@codespeak.net
>> http://codespeak.net/mailman/listinfo/cython-dev
>>
>
>
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to