[Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Don Stewart
rendel: Prabhakar Ragde wrote: divisors i = [j | j-[1..i-1], i `mod` j == 0] main = print [i | i-[1..1], i == sum (divisors i)] Jerzy Karczmarczuk wrote: My point didn't concern that point. Haskell compiler cannot change an algorithm using lists into something which deals with

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: Finally, we can manually translate the C code into a confusing set of nested loops with interleaved IO, main = loop 1 where loop !i | i 1 = return () | otherwise = if i == go i 0 1 then

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Don Stewart
stefanor: On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: Finally, we can manually translate the C code into a confusing set of nested loops with interleaved IO, main = loop 1 where loop !i | i 1 = return () | otherwise = if i ==

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote: stefanor: IO blocks unboxing in GHC. How fast is your mock-C code refactored to do IO outside of the loops only? It doesn't! The above code yields: Main.$wloop :: GHC.Prim.Int# - GHC.Prim.State#

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Tim Chevalier
On 10/28/07, Stefan O'Rear [EMAIL PROTECTED] wrote: On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote: stefanor: IO blocks unboxing in GHC. How fast is your mock-C code refactored to do IO outside of the loops only? It doesn't! The above code yields: Main.$wloop ::

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Don Stewart
dons: stefanor: On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: Finally, we can manually translate the C code into a confusing set of nested loops with interleaved IO, main = loop 1 where loop !i | i 1 = return () |