Re: [Haskell-cafe] Haskell performance question

2007-11-09 Thread Derek Elkins
On Thu, 2007-11-08 at 22:54 -0800, Don Stewart wrote: bulat.ziganshin: definitely, it's a whole new era in low-level ghc programming victory! Now I want a way of getting (well-used) SIMD instructions and such, and with some luck some high-level approach as well.

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Bulat Ziganshin
Hello Dan, Thursday, November 8, 2007, 9:33:12 PM, you wrote: main = do a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } x - readArray a (n-1) print x 1. ghc doesn't implement

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Mikhail Gusarov
Dan Piponi [EMAIL PROTECTED] writes: Even though 'n' is 10 times bigger in the C program it runs much faster than the Haskell program on my MacBook Pro with Haskell 6.6.1. I've tried lots of different combinations of flags that I've found in various postings to haskell-cafe but to no avail.

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Fri, 2007-11-09 at 00:51 +0600, Mikhail Gusarov wrote: Dan Piponi [EMAIL PROTECTED] writes: Even though 'n' is 10 times bigger in the C program it runs much faster than the Haskell program on my MacBook Pro with Haskell 6.6.1. I've tried lots of different combinations of flags that

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 2:48 PM, Duncan Coutts [EMAIL PROTECTED] wrote: You really do not need happy to build ghc. Just ignore the extralibs tarball. Well that was the crucial fact I needed. 6.8.1 is now built. ghci doesn't work, it complains about an unknown symbol '_environ' in HSbase-3.0.0.0.o but I

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Fri, Nov 09, 2007 at 01:39:55AM +0100, Thomas Schilling wrote: On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs Even for GCC (/not/ G_H_C)? No, GCC implements -Ox properly. I

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 05:03:54PM -0800, Stefan O'Rear wrote: On Fri, Nov 09, 2007 at 01:39:55AM +0100, Thomas Schilling wrote: On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Duncan Coutts
On Thu, 2007-11-08 at 13:00 -0800, Dan Piponi wrote: It looks like my whole question might become moot with ghc 6.8.1, but so far I've been unable to build it due to the cyclic happy dependency. You really do not need happy to build ghc. Just ignore the extralibs tarball. You can install any

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
nominolo: On Thu, 2007-11-08 at 10:33 -0800, Dan Piponi wrote: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 11:34 AM, Jason Dusek [EMAIL PROTECTED] wrote: Can you show us your compilation options and timings? I was simply using -O3. I tried a bunch of other flags (copied from the shootout examples) but they made no appreciable difference. I was getting about 1.5s for the Haskell

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Bulat Ziganshin [EMAIL PROTECTED] writes: Hello Dan, Thursday, November 8, 2007, 9:33:12 PM, you wrote: main = do a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } x - readArray a

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs and got: $ time ./ghc-bench 2.0e7 real0m0.714s user0m0.576s sys 0m0.132s $ time ./ghcbC 2000.00 real0m0.305s user0m0.164s sys 0m0.132s This

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Don Stewart [EMAIL PROTECTED] writes: xj2106: I used `unsafePerformIO' with `INLINE', because I don't know where `inlinePerformIO' is now. And also the `-optc-march' is changed to `nocona'. Using unsafePerformIO here would break some crucial inlining. (the same trick is used in

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
dpiponi: On Nov 8, 2007 11:34 AM, Jason Dusek [EMAIL PROTECTED] wrote: Can you show us your compilation options and timings? I was simply using -O3. I tried a bunch of other flags (copied from the shootout examples) but they made no appreciable difference. Argh, -O2 please. -O3 does

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Dan Piponi [EMAIL PROTECTED] writes: My wasn't intended to represent the problem that I'm trying to solve, but the approach I want to take. The problems that I do want to solve don't lend themselves to this kind of approach. My real situation is that I want to write code that has both a

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 10:33 -0800, Dan Piponi wrote: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program:

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 10:33 -0800, Dan Piponi wrote: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program:

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
Bulat, The strictness gave me something like a 10% performance increase making the Haskell code more than 10 times slower than the C. Is this the right type of array to use for performance? -- Dan On Nov 8, 2007 10:36 AM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Dan, Thursday, November

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
Mikhail, main = do print $ foldl' (+) 0 $ take 1 [1.0,1.0..] works 10 times faster than your C version. You just need to adapt to the radically different style of programming. My wasn't intended to represent the problem that I'm trying to solve, but the approach I want to take.

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 11:24 AM, Thomas Schilling [EMAIL PROTECTED] wrote: Wow. You should *really* try using GHC 6.8.1: I was hoping you weren't going to say that :-) As soon as I find a suitable 64-bit Intel binary for MacOSX, or can bootstrap my way out of happy needing happy in my attempted source

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Jason Dusek
Can you show us your compilation options and timings? -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
dpiponi: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program: #include stdio.h #define n 1

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 11:36 AM, Paul Brown [EMAIL PROTECTED] wrote: All that said, I'm not sure where I got the GHC that I used to build the 6.6.1 via MacPorts; I think it shipped with MacOS once upon a time. sudo port install ghc . . . configure: error: GHC is required unless bootstrapping from .hc

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 12:16 PM, Don Stewart [EMAIL PROTECTED] wrote: If you can post the code somewhere, that would be great, with examples of how to reproduce your timings. The code is exactly what I posted originally (but nore that n is 10 times larger in the C code). I compiled using ghc -O3 -o

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
dpiponi: On Nov 8, 2007 12:16 PM, Don Stewart [EMAIL PROTECTED] wrote: If you can post the code somewhere, that would be great, with examples of how to reproduce your timings. The code is exactly what I posted originally (but nore that n is 10 times larger in the C code). I compiled

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 12:36 PM, Don Stewart [EMAIL PROTECTED] wrote: dpiponi: Can you start by retrying with flags from the spectral-norm benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnormlang=ghcid=0 Actually, that was my starting point for investigating how to

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Don Stewart [EMAIL PROTECTED] writes: Can you start by retrying with flags from the spectral-norm benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnormlang=ghcid=0 The interaction with gcc here is quite important, so forcing -fvia-C will matter. Clearly

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
bulat.ziganshin: Hello Don, Thursday, November 8, 2007, 10:53:28 PM, you wrote: a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } oh, i was stupid. obviously, first thing you

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs and got: $ time ./ghc-bench 2.0e7 real0m0.714s user0m0.576s sys 0m0.132s $ time ./ghcbC

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
xj2106: Don Stewart [EMAIL PROTECTED] writes: Can you start by retrying with flags from the spectral-norm benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnormlang=ghcid=0 The interaction with gcc here is quite important, so forcing -fvia-C will

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
bulat.ziganshin: definitely, it's a whole new era in low-level ghc programming victory! -- Don :D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe