On Jun 3, 2013, at 00:23 , Carter Schonwald <carter.schonw...@gmail.com> 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).

Attachment: 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
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to