Replacement for GMP

Peter Tanski p.tanski at gmail.com
Wed Aug 2 14:37:23 EDT 2006


Hi Bulat,

> don't forget about speed/memory efficiency of any programs that use
> Integer "just for case" but really most of their numbers fit in 32/64
> bits. i have one particular program of this type - it builds list of
> all files on disk and Integers are used to save filesizes. i will be
> glad if, vice versa, memory requirements for small integers will be
> reduced to the same as for Ints

I was looking at this yesterday, partly because I read your previous  
discussion in "returning to cost of Integer."  The low-level solution  
Lennart mentioned and that you noted is used in OCaml would be fast  
and convenient for a programmer.  That solution would be much more  
difficult in C--, however, since it requires customisations for  
different processors or operating systems, especially 32 and 64bit  
architectures.  Following the general trend of consensus, it should  
be part of the Bignum library; if the library does not have such a  
test it, as OpenSSL's BN library does not, it would have to be  
added.  (With unmodified OpenSSL, you would have to examine the When  
the Bignum library returned the value to the RTS, the RTS would only  
have to check for the tag and store it accordingly.

>> the same binary that also wants to use GMP.  (Of course, we could  
>> *copy*
>> GMP, changing all the function names.  That would eliminate the
>> problem!)
>
> isn't it rather easy task for some automated tool? i think that even
> existing tools may be found

I know copyrights are weak compared to patents but I do not think  
software copyrights are that weak.  Just changing the names seems  
like a cosmetic change and performing the change through an automated  
system, doubly so.  Copyrighted programs--particularly under the GPL  
license, which also covers the resulting object code--do not lose  
their copyright protection through name-mangling performed by a  
preprocessor.  I think the lawyers for a company using GHC would  
probably be worried about it.

Best Regards,
Peter


More information about the Glasgow-haskell-users mailing list