integer-simple by default
ml at isaac.cedarswampstudios.org
Sun Feb 21 14:37:58 EST 2010
On 02/21/10 14:18, Daniel Fischer wrote:
> Am Sonntag 21 Februar 2010 19:56:54 schrieb Isaac Dupree:
>> We could try to find out how large Integers get, in practice, in
>> existing Haskell code (this may be difficult to find out).
I suspect (just guessing...) that a more reliable way to find out is to
instrument integer-simple to report the sizes of integers it handles.
For example, if you use Rational, (even toRational/fromRational), you
might be handling Integers somewhat larger than you thought you were.
And this could also report on how often the integers get that large.
(Also it's probably only tough operations like multiplication and
division that we need to worry about for large numbers. It's easy to
get linear-time addition, etc.
Incidentally, for operations like Large Number plus or minus Small
Number, it's possible to use a representation that has laziness and
sharing to achieve amortized O(min(m,n)) time. Which is a nice
property... which I believe I implemented in HIntegerByInt... but there
are probably disadvantages to doing it this way too.)
More information about the Glasgow-haskell-users