[plt-scheme] Integer-length

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Mar 22 16:40:51 EST 2006

At Wed, 22 Mar 2006 22:09:40 +0100, Jens Axel Søgaard wrote:
> Jacob Matthews wrote:
> > This seems to beat both Jens' or Joe's implementation handily, at least 
> > in drscheme 301.11  --
> [...]
> > The speedup is probably because mzscheme's log is implemented in C.
> 
> Indeed.

Out of curiosity, did you measure with the JIT and other recent
improvements?

I changed Joe's code to use `quotient' in place of `floor->exact' with
'/'. In 301.11 (with the JIT enabled), then Joe's seems faster for
small numbers, and only slightly slower for numbers around 1000000. For
numbers like 2^30, Joe's is around 4 times slower. For very large
numbers like 2^300000, Joe's is much better.

Of course, I agree that MzScheme should probably provide something like
`integer-length' based on the internal representation of numbers.

Matthew



Posted on the users mailing list.