[Cython] new FFI library for Python

2012-09-17 Thread Saravanan Shanmugham
I have been using CFFI for wrapping a whole bunch of C libraries and I can
tell you its way easier than Cython.

And a couple of clarifications of misconceptions mentioned on this list.
1. It does not "require" GCC at run time. The extension can be compiled
at package/install time using the GCC and can run without need GCC at run
time.
2. Its way easier to wrap C libraries than Cython. I would know, since
I started with Cython. And after many email back and forth with the
cython-users mailing list, I was referred to CFFI which turned out great.
The trouble was wrapping C structures and datastructures with Python
wrappers.
   3. I had to just copy over the C header files as is and had a replace a
few #define values with "..." to ask it to automatically get these values
during compile time from the compiler.  This makes it even more simpler.


Now, I am still a Cython lover when it comes optimizing portions of my
Python code and having it compiled to C.

The question I had in mind is, If I had say a shared math library
libmath.so and wrapped it with a CFFI based python wrapper, which includes
a portion of python wrapper code that calls into the generated Python/C
wrapper shared library.
And then wrote a piece of cython code that invoked that CFFI based python
wrapper, how will my performance be compared to
writing the python wrapper for libmath.so with  cython cdef or cpdef
wrapper function definitions.

Thanks,
Sarvi
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] new FFI library for Python

2012-09-17 Thread Dag Sverre Seljebotn


Saravanan Shanmugham  wrote:

>I have been using CFFI for wrapping a whole bunch of C libraries and I
>can
>tell you its way easier than Cython.
>
>And a couple of clarifications of misconceptions mentioned on this
>list.
>1. It does not "require" GCC at run time. The extension can be compiled
>at package/install time using the GCC and can run without need GCC at
>run
>time.
> 2. Its way easier to wrap C libraries than Cython. I would know, since
>I started with Cython. And after many email back and forth with the
>cython-users mailing list, I was referred to CFFI which turned out
>great.
>The trouble was wrapping C structures and datastructures with Python
>wrappers.
>3. I had to just copy over the C header files as is and had a replace a
>few #define values with "..." to ask it to automatically get these
>values
>during compile time from the compiler.  This makes it even more
>simpler.
>
>
>Now, I am still a Cython lover when it comes optimizing portions of my
>Python code and having it compiled to C.
>
>The question I had in mind is, If I had say a shared math library
>libmath.so and wrapped it with a CFFI based python wrapper, which
>includes
>a portion of python wrapper code that calls into the generated Python/C
>wrapper shared library.
>And then wrote a piece of cython code that invoked that CFFI based
>python
>wrapper, how will my performance be compared to
>writing the python wrapper for libmath.so with  cython cdef or cpdef
>wrapper function definitions.

It will be worse, it will be like calling Python functions rather than C.

Fixing this can be done but would require support in both cffi and Cython.

We were discussing a wrapper-language-neutral protocol for fixing this problem 
(also so that Cython could call numpy.sin and friends without any overhead). 
CEP1000 is an early draft of that idea; it has developed a lot since then but 
the details are in mailing list threads and my and Robert's heads.

If anybody would like to work on that then I'll find the time to write down all 
the ideas me and Robert worked out. (but unless anybody stands ready I'd rather 
wait another month)

Dag Sverre


>
>Thanks,
>Sarvi
>___
>cython-devel mailing list
>cython-devel@python.org
>http://mail.python.org/mailman/listinfo/cython-devel

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.17 final released

2012-09-17 Thread Robert Bradshaw
On Sun, Sep 16, 2012 at 1:48 PM, Yaroslav Halchenko
 wrote:
>
> On Sat, 01 Sep 2012, Stefan Behnel wrote:
>> Release notes: http://wiki.cython.org/ReleaseNotes-0.17
>
> http://wiki.cython.org/ReleaseHistory
> references only 0.16 for me
> ;-)

Fixed.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel