On Jun 3, 2013, at 00:23 , Carter Schonwald <[email protected]> wrote:
> Int is "native register sized integer"
Actually it's not. Read the definition. Int is only guaranteed to be 29 bits.
Here's *one* _actual_ data point (from a 2.8 GHz i7, 64-bit code):
time ./fib
fib(43) = 701408733
3.27 real 3.27 user 0.00 sys
time ./fib-safe
fib(43) = 701408733
3.45 real 3.45 user 0.00 sys
(NB: I do not check the n-1 and n-2 as it's trivial to see from a data flow
analysis
that the proceeding conditional guarantees that those can't overflow.
The empty asm() is necessary to get GCC to generate comparable code).
fib.c
Description: Binary data
Obviously, for some examples this will be much worse, for others, much better, but without this implemented in GHC it will be difficult to measure. Tommy
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
