Replacement for GMP: Update

Peter Tanski p.tanski at gmail.com
Fri Aug 11 18:29:46 EDT 2006


Brian,

> Therefore I'd recommend that licenses for code used by GHC runtime  
> should be either BSD or public domain.

I agree.  I was working on a rewrite of OpenSSL's BN from scratch-- 
maybe a rewrite of GMP would be better--but that is a huge  
undertaking for no other reason than these are big, complex  
projects.  I will have to test Crypto++ and Botan to see if they are  
comparable in a Haskell context (both are written in C++; Crypto++ is  
essentially public domain while Botan has a BSD2 license--reproduce  
copyright in distributions of binary and source code).  I will have  
to write least-common-multiple, bitwise operators and conversions to  
and from floating point representations.

> If the FFI was used for bignum then (talking about Windows OS for  
> the moment) the bignum implementation could just be supplied as a C  
> DLL, perhaps even several different C DLL's for people to choose  
> which one they wanted to distribute with their program based on  
> speed vs licencing issues. Eg if GMP was in a DLL then it would be  
> sufficient to just supply gmp.dll + the gmp LGPL as two files along  
> with the app binary and licensing issues would disappear afaiu.  
> Another advantage of this direction would be that any slowness in  
> the FFI would have to be ironed out, leading to a faster FFI which  
> would be good for other things too eg matrix libs, graphics libs  
> etc. Finally, separating bignum out of GHC runtime would make GHC  
> runtime leaner therefore (hopefully)easier to maintain.

I am testing two versions of GMP against the current internal  
version: one using FFI and another with the ForeignPtrs written in  
C--.  If either is comparable to the internal version that is  
definitely a preferable solution for flexibility.  I have to be very  
picky, though: Simon Marlow, Simon Peyton-Jones and the rest of the  
GHC Team are primarily interested in performance and the integrity of  
the RTS (no one would be happy if the RTS broke for bad FFI calls).

Thanks for the encouragement.

Best regards,
Peter Tanski


More information about the Glasgow-haskell-users mailing list