[Haskell-cafe] Re: C-like Haskell

2009-01-30 Thread Simon Marlow
Lennart Augustsson wrote: I had a quick look at the code for loop :: Int64 - Int64 - Int64 loop i r = if i == 0 then r else loop (i-1) (r+1) It's quite bad. It's full of C calls. It would be much better to do what gcc does and treat Int64 as a primitive type, and just insert C calls for the

[Haskell-cafe] Re: C-like Haskell

2009-01-29 Thread John Lato
On Wed, 2009-01-28 at 20:11 -0500, sam lee wrote: Did you print it? I'm using same code with ghc --make -O2 and it takes forever to finish. Yes, you can see in the output that it prints the same answer in each case. I was using r = 10^9 as you suggested. I wouldn't call these answers the

Re: [Haskell-cafe] Re: C-like Haskell

2009-01-29 Thread Duncan Coutts
On Thu, 2009-01-29 at 10:35 +, John Lato wrote: On Wed, 2009-01-28 at 20:11 -0500, sam lee wrote: Did you print it? I'm using same code with ghc --make -O2 and it takes forever to finish. Yes, you can see in the output that it prints the same answer in each case. I was using r =

Re: [Haskell-cafe] Re: C-like Haskell

2009-01-29 Thread John Lato
On Thu, Jan 29, 2009 at 11:30 AM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Thu, 2009-01-29 at 10:35 +, John Lato wrote: On Wed, 2009-01-28 at 20:11 -0500, sam lee wrote: Did you print it? I'm using same code with ghc --make -O2 and it takes forever to finish. Yes, you

[Haskell-cafe] Re: C-like Haskell

2009-01-28 Thread Benedikt Huber
Ross Mellgren schrieb: Duncan, I think you must have some magics -- on my machine the original code also takes forever. Running with +RTS -S indicates it's allocating several gig of memory or more. Applying some bang patterns gives me ~8s for 10^8 and somewhat more than a minute for 10^9:

[Haskell-cafe] Re: C-like Haskell

2009-01-28 Thread Ross Mellgren
Yeah, you know after sending the email (never a better time) I noticed that the C version wasn't spitting out the right answer. I'm not really sure why, I just replaced bigint with int64_t from stdint.h. -Ross On Jan 28, 2009, at 8:32 PM, Benedikt Huber wrote: Ross Mellgren schrieb: