[plt-scheme] Integer-length
Matthew Flatt wrote:
> At Wed, 22 Mar 2006 22:58:33 +0100, Jens Axel Søgaard wrote:
>
>>It would be interesting to hear the timings on the JIT version.
>
>
> Four sets of times are below:
>
> 1. In a module, JIT enabled
> 2. In a module, JIT disabled
> 3. As a top-level program, JIT enabled
> 4. As a top-level program, JIT disabled
>
> To the last one roughly corresponds to your run, but on my machine.
>
> MzScheme 301.11, x86, Windows.
>
> Matthew
>
> ----------------------------------------
> BIG-TEST
> joe
> cpu time: 1718 real time: 1750 gc time: 891
> jens-axel
> cpu time: 250 real time: 250 gc time: 0
> jacob
> cpu time: 766 real time: 781 gc time: 344
> robby
> cpu time: 734 real time: 734 gc time: 312
> SMALL-TEST-100
> joe
> cpu time: 750 real time: 750 gc time: 389
> jens-axel
> cpu time: 94 real time: 94 gc time: 0
> jacob
> cpu time: 782 real time: 782 gc time: 359
> robby
Since 1. will the "normal" situation, perhaps this
will be better for these tests?
(define (integer-length n)
(if (<= n 65535)
(if (<= n 255)
(if (<= n 15)
(if (<= n 3)
(if (<= n 1)
1
2)
(if (<= n 7)
3
4))
(if (<= n 63)
(if (<= n 31)
5
6)
(if (<= n 127)
7
8)))
(if (<= n 4095)
(if (<= n 1023)
(if (<= n 511)
9
10)
(if (<= n 2047)
11
12))
(if (<= n 16383)
(if (<= n 8191)
13
14)
(if (<= n 32767)
15
16))))
(jens-axel n)))
(define robby2 integer-length)
--
Jens Axel Søgaard