[plt-scheme] Integer-length
Matthew Flatt wrote:
> Out of curiosity, did you measure with the JIT and other recent
> improvements?
Not yet. I used DrScheme without debugging or profiling.
> 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.
I found some interesting tricks for the fixnum range here:
<http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious>
--
Jens Axel Søgaard