bignums, gmp, bytestring, .. ?

Peter Tanski p.tanski at
Sun Nov 19 11:05:36 EST 2006

Hi Neil,

On Nov 17, 2006, at 7:44 PM, Neil Mitchell wrote:
>> - do all those who want to distribute binaries, but not dynamically
>>     linked, need bignums?
>> - it would be nice to know just how far off a good haskell version
>>     would be performance-wise..
>> - what would be a killer for numerical programming, might still be
>>     quite acceptable for a substantial part of haskell uses?
> One advantage you probably haven't thought of is the size of the
> binary. Currently GMP adds about 50Kb on to the Yhc runtime, for what
> in the most cases is probably an occasional addition. If the bytecode
> for a bignum library was less than this then there could be a
> substantial size saving.

The entire static GMP library is 1.090976 MB on my machine (Mac OS  
X), so 50KB is not much for the static linker to include.  A  
replacement library should be smaller (written in Haskell it would be  
much larger but only included as necessary): maybe 30-40KB.   
Depending on the compiler used for the replacement library, the code  
could be even smaller (for Intel it might be larger, for Microsoft  
CL, IBM XL or Sun CC it should be smaller).  GCC has historically  
produced relatively large binaries; though v4.2 might be a little  
better I can't count on that as MinGW still distributes 3.5.  The  
replacement library would still add a bit to every binary if it was  
included in the runtime.  Fortunately for Yhc, bytecode programs may  
be much smaller.  For other Haskell compilers dynamic libraries are  
only alternative to a library (as opposed to primitive)  
implementation of Integer.

> (Of course, Yhc has absolutely no license issues with libgmp, and
> would have substantially worse performance than GHC at bignum
> optimisation)

That is always subject to change :)


More information about the Glasgow-haskell-users mailing list