wangtongada / gmpy

Automatically exported from code.google.com/p/gmpy
GNU Lesser General Public License v3.0
0 stars 0 forks source link

use cython? #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Is it a good idea to use Cython for the wrappers? I think it'd be much
easier to maintain it, than hand written wrappers. Just a thought.

Original issue reported on code.google.com by ondrej.c...@gmail.com on 24 Oct 2008 at 6:27

GoogleCodeExporter commented 8 years ago
Actually an enhancement-request.

Original comment by alea...@gmail.com on 28 Oct 2008 at 2:21

GoogleCodeExporter commented 8 years ago
In http://www.mail-archive.com/cython-dev@codespeak.net/msg02827.html
there is a discussion on how to write a wrapper for GMP in Cython
which performs as well as gmpy.
In the attachment there is an implementation in Cython which is faster
than gmpy in the bench example in the above link, and which performs
as well as gmpy in running mpmath's runtests.py

What improves performance is caching, which is implemented using code
from Sage; the only difference is that in fast_tp_dealloc() the memory
is not freed; this improves performance (maybe the same could be done
in Sage), and it is analogous to the caching in gmpy.

The advantage in using Cython wrapped GMP is that other Cython
libraries can be developed independently that cimport it; this is true
in particular for mpmath.

Original comment by mario.pe...@gmail.com on 4 May 2009 at 11:22

Attachments:

GoogleCodeExporter commented 8 years ago
Great job, I like this a lot. This would be useful for sympy too, for our Cython
core. Thanks very much!

Original comment by ondrej.c...@gmail.com on 4 May 2009 at 11:27

GoogleCodeExporter commented 8 years ago
Thank you, this is very much appreciated. I'll make time in the next couple 
days to
take a close look.

Original comment by casevh on 5 May 2009 at 6:56

GoogleCodeExporter commented 8 years ago
Very interesting!

Original comment by fredrik....@gmail.com on 5 May 2009 at 7:22

GoogleCodeExporter commented 8 years ago
Sorry for the delay in response. 

It is faster than even the existing trunk version of gmpy. I've been working on
trying to make the existing gmpy compatible with Python 3 and I'm debating 
which will
be easier: hacking the existing version or writing a new version in Cython.

I've posted a message to gmpy-dev to discuss the future of gmpy. Can we 
continue the
discussion there?

Original comment by casevh on 3 Jun 2009 at 7:18