Legend:

Esa Ilari Vuokko, who at one time attempted to replace GMP with [http://math.libtomcrypt.com/ LibTomMath], posted several messages with good notes on the current implementation. Much of what is on this page is derived from those notes. See, [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010669.html Replacement for GMP(3)] and [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010674.html Replacement for GMP(4)].

64

64

65

==== Files related to GMP in the GHC Compiler Source Code ====

66

67

Note: references are relative to the main directory of the source distribution; links below are to the darcs repository at [http://darcs.haskell.org/ghc http://darcs.haskell.org/ghc].

* [http://darcs.haskell.org/ghc/rts/gmp/ rts/gmp (directory)] (Modify: recommended to remove entirely, i.e., do not add conditional compilation for users who want to keep on using GMP)

87

88

==== Optimisation Opportunities ====

89

90

The current GMP integeration...

91

65

92

=== Benchmarks for Multi-Precision Libraries ===

66

93

67

The benchmarks below were made with unmodified multi-precision libraries for Integral Arithmetic compiled using Apple gcc 4.0.1 with optimisation settings: -O3 -ftree-vectorize -falign-loops=16. The tests performed Multiplication, Squaring, Powers (up to 7) and Division each 1,000,000 times at various levels of precision based on the number of bits in the operands. Multi-precision libraries may use unsigned chars, unsigned ints, unsigned long ints, unsigned long long ints or doubles, so the actual number of "words" in each multi-precision array may differ; for multi-precision real numbers using doubles, integer precision was calculated at 48.3 bits of real precision per double, rounded up to 49. (49 bits conservatively equates to about 9 decimal digits of precision, see, e.g., [http://docs.sun.com/source/806-3568/ncg_goldberg.html What Every Computer Scientist Should Know about Floating-Point Arithmetic].) Libraries tested were:

94

The benchmarks below were made with unmodified multi-precision libraries for Integral Arithmetic compiled using Apple gcc 4.0.1 with optimisation settings: -O3 -ftree-vectorize -falign-loops=16. The tests performed Multiplication, Squaring, Powers (up to 7) and Division each 1,000,000 times at the base level of bit-precision (the number of bits in the operands). Higher levels of precision performed incrementally fewer rounds: the base level (1,000,000 / (i * 3)) where i is the number for the round, incremented from 0. For example, at a bit-precision of 512 (second bit-precision test), the number of rounds was (1,000,000 / (1 * 3)) = (1,000,000 / 3) = 333,333 rounds. Multi-precision libraries may use unsigned chars, unsigned ints, unsigned long ints, unsigned long long ints or doubles, so the actual number of "words" in each multi-precision array may differ; for multi-precision real numbers using doubles, integer precision was calculated at 48.3 bits of real precision per double, rounded up to 49. (49 bits conservatively equates to about 9 decimal digits of precision, see, e.g., [http://docs.sun.com/source/806-3568/ncg_goldberg.html What Every Computer Scientist Should Know about Floating-Point Arithmetic].) Libraries tested were: