Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-29 Thread Roman Leshchinskiy
On 29/03/2010, at 02:27, Lennart Augustsson wrote: Does anything change if you swap the first two rhss? No, not as far as I can tell. On Sun, Mar 28, 2010 at 1:28 AM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: On 28/03/2010, at 09:47, Lennart Augustsson wrote: It's important to

Re: [Haskell-cafe] GHC vs GCC

2010-03-28 Thread Jan-Willem Maessen
On Sat, Mar 27, 2010 at 8:16 PM, Roman Leshchinskiy r...@cse.unsw.edu.auwrote: On 28/03/2010, at 01:36, Jan-Willem Maessen wrote: It's worth pointing out that there's a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!). A non-buggy

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-28 Thread Lennart Augustsson
Does anything change if you swap the first two rhss? On Sun, Mar 28, 2010 at 1:28 AM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: On 28/03/2010, at 09:47, Lennart Augustsson wrote: It's important to switch from mod to rem.  This can be done by a simple abstract interpretation. Also,

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread David Menendez
On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It went down to 10s.

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread wren ng thornton
David Menendez wrote: On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Grzegorz C
Hi, Rafael Almeida wrote: On Fri, Mar 26, 2010 at 6:49 PM, Jason Dagit da...@codersbase.com wrote: Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It went

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Neil Mitchell
Hi John, Any chance of seeing the benchmark? You're not the only one with an optimising compiler tucked away somewhere :-) I have one benchmark where I outperform GHC by 21 times, although saying it's artificial is a bit of an understatement... Thanks, Neil On Fri, Mar 26, 2010 at 6:27 PM,

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Jan-Willem Maessen
On Sat, Mar 27, 2010 at 12:43 AM, Rafael Almeida almeida...@gmail.comwrote: On Fri, Mar 26, 2010 at 6:49 PM, Jason Dagit da...@codersbase.com wrote: On Fri, Mar 26, 2010 at 2:33 PM, Bryan O'Sullivan b...@serpentine.com wrote: On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Pom
On 10-03-26 11:50 PM, wren ng thornton wrote: Well GHC has an -O3[1], but it's not a good idea to use it. Some of the optimizations that -O3 does can result in slower code for particular programs. Whereas -O2 is safe and never results in pessimizations. Slightly off topic, but ACOVEA may

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Xiao-Yong Jin
On Fri, 26 Mar 2010 21:56:16 -0700, Thomas DuBuisson wrote: Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It went down to 10s. Bang patterns should have

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Tillmann Rendel
Jan-Willem Maessen wrote: It's worth pointing out that there's a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!). A non-buggy strictness analyzer should expose the strictness of these functions without difficulty. Could the result of

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread David Menendez
On Sat, Mar 27, 2010 at 1:45 PM, Tillmann Rendel ren...@mathematik.uni-marburg.de wrote: Jan-Willem Maessen wrote: It's worth pointing out that there's a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!).  A non-buggy strictness analyzer should

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Jason Dagit
On Sat, Mar 27, 2010 at 3:25 AM, Neil Mitchell ndmitch...@gmail.com wrote: Hi John, Any chance of seeing the benchmark? You're not the only one with an optimising compiler tucked away somewhere :-) Neil, for some reason John's reply didn't thread with the rest of the thread. Probably

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Rafael Cunha de Almeida
John Meacham wrote: Here are jhc's timings for the same programs on my machine. gcc and ghc both used -O3 and jhc had its full standard optimizations turned on. jhc: ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total gcc: ./a.out 5.58s user 0.00s system 97% cpu 5.710 total ghc:

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Lennart Augustsson
It's important to switch from mod to rem. This can be done by a simple abstract interpretation. I'm nore sure if it's jhc or gcc that does this for jhc. -- Lennart On Sat, Mar 27, 2010 at 10:30 PM, Rafael Cunha de Almeida almeida...@gmail.com wrote: John Meacham wrote: Here are jhc's

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Rafael Cunha de Almeida
Lennart Augustsson wrote: It's important to switch from mod to rem. This can be done by a simple abstract interpretation. I'm nore sure if it's jhc or gcc that does this for jhc. It's not just adding rem. Ghc still runs much slower using rem. It's only when switching to -fvia-C and using

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread John Meacham
On Sat, Mar 27, 2010 at 07:30:30PM -0300, Rafael Cunha de Almeida wrote: John Meacham wrote: Here are jhc's timings for the same programs on my machine. gcc and ghc both used -O3 and jhc had its full standard optimizations turned on. jhc: ./hs.out 5.12s user 0.07s system 96% cpu 5.380

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 01:36, Jan-Willem Maessen wrote: It's worth pointing out that there's a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!). A non-buggy strictness analyzer should expose the strictness of these functions without difficulty.

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 27/03/2010, at 05:27, John Meacham wrote: Here are jhc's timings for the same programs on my machine. gcc and ghc both used -O3 and jhc had its full standard optimizations turned on. jhc: ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total gcc: ./a.out 5.58s user 0.00s system 97%

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 11:07, John Meacham wrote: I have not thoroughly checked it, but I think there are a couple things going on here: It could also be worthwhile to float out (i*i + j*j) in rangeK instead of computing it in every loop iteration. Neither ghc nor gcc can do this; if jhc can then

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 09:47, Lennart Augustsson wrote: It's important to switch from mod to rem. This can be done by a simple abstract interpretation. Also, changing the definition of rem from a `rem` b | b == 0 = divZeroError | a == minBound b == (-1) =

[Haskell-cafe] GHC vs GCC

2010-03-26 Thread Rafael Cunha de Almeida
Hello, During a talk with a friend I came up with two programs, one written in C and another in haskell. Haskell main :: IO () main = print $ rangeI 0 0 rangeK :: Int - Int - Int - Int - Int rangeK i j k acc | k 1000 = if i *

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Jason Dagit
On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida almeida...@gmail.com wrote: Hello, During a talk with a friend I came up with two programs, one written in C and another in haskell. Haskell main :: IO () main = print $ rangeI 0 0 rangeK :: Int - Int - Int

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-26 Thread John Meacham
Here are jhc's timings for the same programs on my machine. gcc and ghc both used -O3 and jhc had its full standard optimizations turned on. jhc: ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total gcc: ./a.out 5.58s user 0.00s system 97% cpu 5.710 total ghc: ./try 31.11s user 0.00s system

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Bryan O'Sullivan
On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida almeida...@gmail.com wrote: During a talk with a friend I came up with two programs, one written in C and another in haskell. Your Haskell code builds a huge thunked accumulator value, so of course it's slow (put bang patterns on all

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Jason Dagit
On Fri, Mar 26, 2010 at 2:33 PM, Bryan O'Sullivan b...@serpentine.comwrote: On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida almeida...@gmail.com wrote: During a talk with a friend I came up with two programs, one written in C and another in haskell. Your Haskell code builds a

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Felipe Lessa
I'd guess that the LLVM backend could generate code that is at least as fast as gcc. It would be nice if you could test it. -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Bernie Pope
On 27 March 2010 04:46, Rafael Cunha de Almeida almeida...@gmail.com wrote: During a talk with a friend I came up with two programs, one written in C and another in haskell. snip The Haskell version: real    0m45.335s user    0m45.275s sys     0m0.004s against the C version: real    

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Thomas DuBuisson
On Fri, Mar 26, 2010 at 6:16 PM, Felipe Lessa felipe.le...@gmail.com wrote: I'd guess that the LLVM backend could generate code that is at least as fast as gcc. It would be nice if you could test it. NCG done with GHC 6.12.1 w/ -O3 LLVM using a version of HEAD w/ -O3 GCC version 4.4.3 w/ -O3

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Rafael Almeida
On Fri, Mar 26, 2010 at 10:42 PM, Bernie Pope florbit...@gmail.com wrote: On 27 March 2010 04:46, Rafael Cunha de Almeida almeida...@gmail.com wrote: During a talk with a friend I came up with two programs, one written in C and another in haskell. snip The Haskell version: real    

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Rafael Almeida
On Fri, Mar 26, 2010 at 6:49 PM, Jason Dagit da...@codersbase.com wrote: On Fri, Mar 26, 2010 at 2:33 PM, Bryan O'Sullivan b...@serpentine.com wrote: On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida almeida...@gmail.com wrote: During a talk with a friend I came up with two

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Thomas DuBuisson
Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It went down to 10s. Bang patterns should have helped tons - it isn't GHC thats at fault here and yes it does