Re: [Chicken-hackers] [PATCH] Mostly fix #1604

2019-05-18 Thread felix . winkelmann
> Here's what I figured out fwiw: > > This is the program from #1604: > > (define (fib n) > (if (or (= n 0) (= n 1)) > n > (+ (fib (- n 1)) (fib (- n 2) > > (time (let loop ((n 0)) > (when (< n 35) > (fib n) > (loop (+ n 1) > >

Re: [Chicken-hackers] [PATCH] Mostly fix #1604

2019-05-18 Thread Peter Bex
On Sat, May 18, 2019 at 06:15:07PM +0200, felix.winkelm...@bevuta.com wrote: > > Finally, I ran into this head scratcher: I tried to replace = with eq? in > > the code and it sped up the code by a *lot*. However, in fixnum > > arithmetic mode, = gets rewritten to C_eqp. The difference in the C >

Re: [Chicken-hackers] [PATCH] Mostly fix #1604

2019-05-18 Thread megane
Peter Bex writes: > Hi all, > > Attached is a patch to restore rewrites for the common arithmetic > operators when in fixnum arithmetic mode. > Interesing stuff! [snip] > > Finally, I ran into this head scratcher: I tried to replace = with eq? in > the code and it sped up the code by a

Re: [Chicken-hackers] [PATCH] Mostly fix #1604

2019-05-18 Thread felix . winkelmann
> Finally, I ran into this head scratcher: I tried to replace = with eq? in > the code and it sped up the code by a *lot*. However, in fixnum > arithmetic mode, = gets rewritten to C_eqp. The difference in the C > output is that the code that uses eq? directly gets this completely > inlined in

[Chicken-hackers] [PATCH] Mostly fix #1604

2019-05-18 Thread Peter Bex
Hi all, Attached is a patch to restore rewrites for the common arithmetic operators when in fixnum arithmetic mode. I'm not 100% happy with it, because as the patch says, the scrutinizer will preemptively rewrite some calls before we can figure out that we can unsafely use the fixnum versions.