Replacement for GMP: Update

Bulat Ziganshin bulat.ziganshin at
Fri Aug 11 01:34:10 EDT 2006

Hello Peter,

Friday, August 11, 2006, 4:00:40 AM, you wrote:

> OpenSSL's BN library is primarily tuned to support cryptography,
> particularly the generation of very large primes for public key  
> cryptosystems.  It is possible to separate the BN library out (I am  
> having some success there already).  It is also possible to use the  
> library separately from Haskell using ForeignPtr; essentially doing  
> everything through Haskell's FFI.  I have honestly not benchmarked a  
> FFI-ForeignPtr interface against the current internal-GMP  
> implementation, partly because the overhead required to use  
> ForeignPtr and the availability of garbage-collected memory for GMP  
> indicate that an internal GHC Bignum library would clearly be  
> faster.

why you say that ForeignPtr is slow? afaik, malloc/free is slow, but
starting from ghc 6.6 speed of _using_ ForeignPtr is the same as for Ptr

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Glasgow-haskell-users mailing list