Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-24 Thread Bryan O'Sullivan
On Wed, May 23, 2012 at 10:52 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: Past century? Insults, is it? Do you fine gentlemen absolutely have to continue this endless, offtopic, unedifying back-and-forth in public? Please. ___ Haskell-Cafe

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-24 Thread Isaac Gouy
Sorry Bryan, there are a couple of comments I should make a final reply to - I'll ignore the rest. From: Richard O'Keefe o...@cs.otago.ac.nz Sent: Wednesday, May 23, 2012 10:52 PM -snip- Says who? Is that on your own authority or some other source you can point us to? It looks

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-24 Thread Ryan Newton
Oops, forgot to reply-to-all. This was a minor clarification on Wren's behalf (he can correct me if I'm wrong). But I agree with Bryan that it's time for the thread to die: Do bear in mind that Java doesn't optimize ---that's the JIT's job What are we supposed to make of that? Why write

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-24 Thread Chris Dornan
Oops, forgot to reply-to-all. N! You had the right idea the first time. :-) (Please excuse us while we chide you as humorously as we can into putting this thread out of its misery.) Chris ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-23 Thread Yves Parès
I understand your concerns about modifying the current ideology, it's fair enough. Actually I'm myself more in favor of adding strict couterparts, and export them conjointly, to support both the mathematical roots and the performances of the operations that are done most of time (Which kind of

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-23 Thread Isaac Gouy
From: Richard O'Keefe o...@cs.otago.ac.nz Sent: Tuesday, May 22, 2012 7:59 PM But string processing and text I/O using the java.io.* classes aren't brilliant. Wait just a moment - Are you comparing text I/O for C programs that process bytes against Java programs that process double-byte

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-23 Thread Isaac Gouy
From: wren ng thornton w...@freegeek.org Sent: Tuesday, May 22, 2012 9:30 PM -snip- FWIW, that matches my expectations pretty well. Naive/standard Java performing slower than Smalltalk; highly tweaked Java using non-standard data types performing on-par with or somewhat faster than

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-23 Thread Richard O'Keefe
On 24/05/2012, at 4:39 AM, Isaac Gouy wrote: From: Richard O'Keefe o...@cs.otago.ac.nz Sent: Tuesday, May 22, 2012 7:59 PM But string processing and text I/O using the java.io.* classes aren't brilliant. Wait just a moment - Are you comparing text I/O for C programs that process

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread Isaac Gouy
From: Richard O'Keefe Sent: Monday, May 21, 2012 6:54 PM On 22/05/2012, at 4:15 AM, Isaac Gouy wrote:   Actually, I/O bound is *good*.   Why would that be good or bad? The context here is a UNIX-style topological sorting program. Being I/O bound means that the program is limited by how

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread Richard O'Keefe
On 23/05/2012, at 4:54 AM, Isaac Gouy wrote: There may be very little one can do about the I/O part. Maybe you could say how the Java I/O is being done. For 50,000 nodes and 8,385,254 edges, Java (first version) ran out of memory after 89.54 seconds (default heap) Java (2nd

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread wren ng thornton
On 5/21/12 10:51 AM, Yves Parès wrote: I do think we have the opposite problem, however, in much Haskell code -- people are using the clean, obviously correct, but inefficient code even in standard library functions that really should be optimized like crazy! And even before optimizing like

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread wren ng thornton
On 5/22/12 12:54 PM, Isaac Gouy wrote: On 5/21/2012 6:54 PM, Richard O'Keefe wrote: For 50,000 nodes and 8,385,254 edges, Java (first version) ran out of memory after 89.54 seconds (default heap) Java (2nd version) 13.31 seconds -- avoid Integer boxing! Java (3rd

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Ryan Newton
The unconditional desire for maximum possible object code performance is usually very stupid, not to mention impossible to reach with any high level language and any multi-tasking operating system. Definitely. I don't know if we have a catchy term for kneejerk optimization or if it falls

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Ertugrul Söylemez
Ryan Newton rrnew...@gmail.com wrote: I do think we have the opposite problem, however, in much Haskell code -- people are using the clean, obviously correct, but inefficient code even in standard library functions that really should be optimized like crazy! Not necessarily. For example the

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Yves Parès
I do think we have the opposite problem, however, in much Haskell code -- people are using the clean, obviously correct, but inefficient code even in standard library functions that really should be optimized like crazy! And even before optimizing like crazy, I think the functions that are more

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Yves Parès
Not necessarily. For example the 'nub' function from Data.List could be much faster. Unfortunately this would also change its type. O(n²) complexity is really the best you can get with the Eq constraint. Why not in that kind of cases provide a second function (named differently), together

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Thomas DuBuisson
On Mon, May 21, 2012 at 7:53 AM, Yves Parès yves.pa...@gmail.com wrote: Not necessarily.  For example the 'nub' function from Data.List could be much faster.  Unfortunately this would also change its type.  O(n²) complexity is really the best you can get with the Eq constraint. Why not in

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Sam Martin
Yes, this seems to be a separate disease.  Not just using low-level langs, per se, but using them for *everything*.  I have worked at places in industry where teams automatically use C++ for everything.  For example, they use it for building all complete GUI applications, which

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Isaac Gouy
From: Richard O'Keefe o...@cs.otago.ac.nz Sent: Sunday, May 20, 2012 3:41 PM On 19/05/2012, at 5:51 AM, Isaac Gouy wrote: In the 'tsort' case, it turns out that the Java and Smalltalk versions are I/O bound with over 90% of the time spent just reading the data. My guess is that they could

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Yves Parès
If you are writing a program or system that has significant performance requirements, you might just be better off doing the whole thing in C/C++ and living with the annoyance of doing GUIs I fail to see how the GUI part would suffer from lack of performance if the rest of the system is fine. I

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Stephen Tetley
On 21 May 2012 17:27, Yves Parès yves.pa...@gmail.com wrote: I fail to see how the GUI part would suffer from lack of performance if the rest of the system is fine. I would hate to be bold, but to me this case sounds a little bit like MVC done wrong if the breaking GUI apart from the rest of

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Isaac Gouy
From: Stephen Tetley stephen.tet...@gmail.com Sent: Monday, May 21, 2012 10:08 AM Subject: Re: [Haskell-cafe] Can Haskell outperform C++? On 21 May 2012 17:27, Yves Parès yves.pa...@gmail.com wrote: I fail to see how the GUI part would suffer from lack of performance if the rest

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Richard O'Keefe
On 22/05/2012, at 4:15 AM, Isaac Gouy wrote: Actually, I/O bound is *good*. Why would that be good or bad? The context here is a UNIX-style topological sorting program. Being I/O bound means that the program is limited by how fast it can read the data. If 90% of the time goes into reading

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-20 Thread Richard O'Keefe
On 19/05/2012, at 5:51 AM, Isaac Gouy wrote: In the 'tsort' case, it turns out that the Java and Smalltalk versions are I/O bound with over 90% of the time spent just reading the data. My guess is that they could be written to do better than that - but it's idiotic of me to say so

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-20 Thread Richard O'Keefe
How much is hard to port a haskell program to C ? If it will become harder and harder, (i.e. for parallelizations) than it's fair to choose haskell for performance, but if it's not, I think it's hard to think that such a high level language could ever compile down to something running faster

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread wren ng thornton
On 5/16/12 7:43 AM, Yves Parès wrote: On the one hand, characterizing those who desire the best performance possible as simple-minded is, at best, a gross over-generalization. Like you, I work in a field where optimization is king (e.g., in machine translation, program runtimes are measured in

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread Ertugrul Söylemez
wren ng thornton w...@freegeek.org wrote: However, while the logical interpretation of Ertugrul's words may be that simple-mindedness implies performance-desire, that interpretation is not the only one available to the standard interpretation of his words, nor IMO the dominant interpretation.

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread wren ng thornton
On 5/16/12 3:57 PM, Bardur Arantsson wrote: Comparing languages is a highly non-trivial matter involving various disciplines (including various squidgy ones) and rarely makes sense without a very specific context for comparison. Exactly. That's what I was trying to get at re the problems of

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread wren ng thornton
On 5/18/12 7:45 AM, Roman Werpachowski wrote: On Fri, 18 May 2012 15:30:09 +1200, Richard O'Keefeo...@cs.otago.ac.nz wrote: The claim was and remains solely that THE TIME DIFFERENCE BETWEEN *ALGORITHMS* can be bigger than THE TIME DIFFERENCE BETWEEN *LANGUAGES* and is in this particular

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread wren ng thornton
On 5/16/12 4:37 PM, Gregg Lebovitz wrote: 1) Outstanding best practices documents that capture this knowledge and provides useful answers. Organizing this information in an online document that can be searched by keyword or index would be really helpful. The hard part will be maintaining it. As

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread Paolino
Hello, I would like to add questions to yours. I'm not sure that C++ programs are same performance as C actually, so I can have a bad logic. How much is hard to port a haskell program to C ? If it will become harder and harder, (i.e. for parallelizations) than it's fair to choose haskell for

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread Roman Werpachowski
Date: Sat, 19 May 2012 08:57:38 +0200 From: Ertugrul S?ylemez e...@ertes.de Subject: Re: [Haskell-cafe] Can Haskell outperform C++? To: haskell-cafe@haskell.org Message-ID: 20120519085738.37548...@tritium.streitmacht.eu Content-Type: text/plain; charset=us-ascii Haskell delivers

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread Janis Voigtländer
Am 19.05.2012 12:00, schrieb wren ng thornton: Exactly. That's what I was trying to get at re the problems of comparing Haskell to C++ (or indeed any pair of dissimilar languages). A legitimate comparison will involve far more than microbenchmarks, but then a legitimate comparison must always

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-19 Thread Isaac Gouy
From: wren ng thornton w...@freegeek.org Sent: Saturday, May 19, 2012 12:49 AM Subject: Re: [Haskell-cafe] Can Haskell outperform C++? -snip- Fair in what sense? That is, what _exactly_ are you hoping to compare? If the goal is to benchmark the implementation of the runtime, VM

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-18 Thread Roman Werpachowski
Date: Fri, 18 May 2012 15:30:09 +1200 From: Richard O'Keefe o...@cs.otago.ac.nz Subject: Re: [Haskell-cafe] Can Haskell outperform C++? To: Roman Werpachowski roman.werpachow...@gmail.com Cc: haskell-cafe@haskell.org Message-ID: b43b8ce3-9f90-4dc3-8725-d62298397...@cs.otago.ac.nz Content

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-18 Thread Isaac Gouy
- Original Message - From: Richard O'Keefe o...@cs.otago.ac.nz Sent: Thursday, May 17, 2012 8:30 PM Subject: Re: [Haskell-cafe] Can Haskell outperform C++? -snip- The claim was and remains solely that THE TIME DIFFERENCE BETWEEN *ALGORITHMS*   can be bigger than THE TIME

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-18 Thread ok
There was and is no claim that method 2 is much harder to implement in C or C++.  In fact both methods *were* implemented easily in C. OK, got that now. So Haskell doesn't have a *big* advantage over C w/r to the ease of implementation of both algorithms? In the case of these specific

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-18 Thread Isaac Gouy
- Original Message - From: o...@cs.otago.ac.nz o...@cs.otago.ac.nz Sent: Friday, May 18, 2012 9:38 AM Subject: Re: [Haskell-cafe] Can Haskell outperform C++? -snip- and if we want to compare *languages*, we should use identical algorithms to make the comparison fair

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-18 Thread Paulo Pocinho
I've been following the topic in both threads. Very nice discussion. On 18 May 2012 18:51, Isaac Gouy igo...@yahoo.com wrote: Moreover, being absolutely sure that the algorithms are in some sense identical might make comparison pointless - for example, when the same assembly is generated by

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Roman Werpachowski
Date: Wed, 16 May 2012 06:54:08 -0400 From: wren ng thornton w...@freegeek.org Subject: Re: [Haskell-cafe] Can Haskell outperform C++? To: haskell-cafe@haskell.org Message-ID: 4fb38750.9060...@freegeek.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed But on the other hand

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Roman Werpachowski
From: Richard O'Keefe o...@cs.otago.ac.nz Subject: Re: [Haskell-cafe] Can Haskell outperform C++? To: Haskell Cafe haskell-cafe@haskell.org Message-ID: 5f6605a2-dfe0-4aea-9987-3b07def34...@cs.otago.ac.nz Content-Type: text/plain; charset=us-ascii On 17/05/2012, at 2:04 PM, Gregg Lebovitz

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Gregg Lebovitz
Roman, I think this question is for Richard. I haven't had a chance to play with these methods. I will try to do that today. Gregg On 5/17/2012 6:07 AM, Roman Werpachowski wrote: From: Richard O'Keefeo...@cs.otago.ac.nz Subject: Re: [Haskell-cafe] Can Haskell outperform C++? To: Haskell

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Gregg Lebovitz
Isaac, I see your point. Probably I shouldn't have made that assertion given my limited understanding of the benchmarks. I want to thank you for your kind and gentle way of pointing this out to me. I feel very welcomed and encourage. I still plan to work on the performance paper with the

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Isaac Gouy
From: Gregg Lebovitz glebov...@gmail.com Sent: Thursday, May 17, 2012 5:50 AMI look forward to Subject: Re: [Haskell-cafe] Can Haskell outperform C++? Isaac, I see your point. Probably I shouldn't have made that assertion given my limited understanding of the benchmarks. I want

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Gregg Lebovitz
: Thursday, May 17, 2012 5:50 AMI look forward to Subject: Re: [Haskell-cafe] Can Haskell outperform C++? Isaac, I see your point. Probably I shouldn't have made that assertion given my limited understanding of the benchmarks. I want to thank you for your kind and gentle way of pointing this out

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-17 Thread Richard O'Keefe
On 17/05/2012, at 10:07 PM, Roman Werpachowski wrote: No slide deck required. The task is generating alternating permutations. Method 1: generate permutations using a backtracking search; when a permutation is generated, check if it is alternating. Method 2: use the same

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread wren ng thornton
On 5/10/12 8:44 PM, Ryan Newton wrote: through the trouble of writing my algorithms in C/C++, but simple-minded people often have a desire to get the best performance possible, in which case you really want to use C, C++, Fortran or whatever high level assembler language you like. I think this

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Yves Parès
On the one hand, characterizing those who desire the best performance possible as simple-minded is, at best, a gross over-generalization. Like you, I work in a field where optimization is king (e.g., in machine translation, program runtimes are measured in days). You misread the logical

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Gregg Lebovitz
Wren, I see at least three different issues being discussed here. I think it is important to delineate them: 1) Does Haskell and its libraries need performance improvements? Probably yes. Some of the performance issues seem to be related to the way the language is implemented and others by

[Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Isaac Gouy
Wed May 16 16:40:26 CEST 2012, Gregg Lebovitz wrote: 2) ... I think the problem with current comparisons, is that they are designed to favor imperative languages. Please be specific: - Which current comparisons? - How do you know what they are designed to favor?

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Kevin Charter
On Wed, May 16, 2012 at 8:40 AM, Gregg Lebovitz glebov...@gmail.com wrote: 1) Does Haskell and its libraries need performance improvements? Probably yes. Some of the performance issues seem to be related to the way the language is implemented and others by how it is defined. Developers really

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Gregg Lebovitz
Isaac, I was looking at the debian coding contest benchmarks referenced by others in this discussion. All of the benchmarks algorithms, appear to be short computationally intensive programs with a fairly low level of abstraction. In almost all examples, the requirement says: you must

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Gregg Lebovitz
Kevin, Interesting point. Over the past few weeks as part of my work, I have interviewed a large numbers of Haskell developers from many different industries and have been hearing the same points you are making. Space leaks that were address by learning how

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Bardur Arantsson
On 05/16/2012 09:02 PM, Gregg Lebovitz wrote: Isaac, I was looking at the debian coding contest benchmarks referenced by others in this discussion. All of the benchmarks algorithms, appear to be short computationally intensive programs with a fairly low level of abstraction. In almost

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Kevin Charter
On Wed, May 16, 2012 at 1:17 PM, Gregg Lebovitz glebov...@gmail.com wrote: Also interesting is that in all my interviews, GHC performance was never raised. No one said I have to drop into C to solve that performance problem. That's been my experience too. I've so far been able to get

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Ben Gamari
Kevin Charter kchar...@gmail.com writes: snip For example, imagine you're new to the language, and as an exercise decide to write a program that counts the characters on standard input and writes the count to standard output. A naive program in, say, Python will probably use constant space

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Gregg Lebovitz
Ben, This is precisely the kind of problem I am currently thinking about and why I asked for pointers to documents on best practices. The current model for gaining the necessary experience to use Haskell effectively does not scale well. Here are some ideas on how to address the knowledge

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Yves Parès
The profiler is certainly useful (and much better with GHC 7.4) What are the improvements in that matter? (I just noticed that some GHC flags wrt profiling have been renamed) 2012/5/16 Ben Gamari bgamari.f...@gmail.com Kevin Charter kchar...@gmail.com writes: snip For example, imagine

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Ben Gamari
Yves Parès yves.pa...@gmail.com writes: The profiler is certainly useful (and much better with GHC 7.4) What are the improvements in that matter? (I just noticed that some GHC flags wrt profiling have been renamed) The executive summary can be found in the release notes[1]. There was also a

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Gregg Lebovitz
On 5/16/2012 3:57 PM, Bardur Arantsson wrote: Comparing languages is a highly non-trivial matter involving various disciplines (including various squidgy ones) and rarely makes sense without a very specific context for comparison. So the short answer is: mu. Discovering the long answer

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Isaac Gouy
From: Gregg Lebovitz glebov...@gmail.com Sent: Wednesday, May 16, 2012 12:02 PM I was looking at the debian coding contest benchmarks referenced by others in this discussion. debian coding contest ? It's been called many things but, until now, not that. All of the benchmarks

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Richard O'Keefe
In a lecture today I presented (for quite other reasons) a simple combinatorial enumeration problem where the difference between two algorithms was far larger than any plausible difference between programming languages. If a programming language makes it easier to explore high level

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Gregg Lebovitz
Richard, Thank you. This is an example of what I had in mind when I talked about changing the playing field. Do you have a slide deck for this lecture that you would be willing to share with me? I am very interested in learning more. Gregg On 5/16/2012 9:13 PM, Richard O'Keefe wrote: In a

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Richard O'Keefe
On 17/05/2012, at 2:04 PM, Gregg Lebovitz wrote: Richard, Thank you. This is an example of what I had in mind when I talked about changing the playing field. Do you have a slide deck for this lecture that you would be willing to share with me? I am very interested in learning more. No

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-15 Thread Yves Parès
Yet this resource seems a little outdated: http://www.haskell.org/haskellwiki/Performance/Strings does not speak about Text http://www.haskell.org/haskellwiki/Performance/Arrays about Vector And what's the status of the Streams IO approach detailed in

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-14 Thread Dmitry Vyal
On 05/11/2012 07:53 AM, Ertugrul Söylemez wrote: My point is: If you need C-like performance at a certain spot there is really no excuse for writing the entire application in C. Haskell has a working, powerful enough FFI. Also idiomatic Haskell code nowadays performs close to C. If your code

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-14 Thread Ertugrul Söylemez
Dmitry Vyal akam...@gmail.com wrote: My point is: If you need C-like performance at a certain spot there is really no excuse for writing the entire application in C. Haskell has a working, powerful enough FFI. Also idiomatic Haskell code nowadays performs close to C. If your code doesn't,

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-14 Thread Ryan Newton
Well, if it's in many ways the same as C, then again it's probably not idiomatic Haskell. It's just a recursive equation for mandelbrot fractals. I should have been precise, I didn't mean that the source is literally the *same* as the C source (i.e. there's no for loop, no mutable

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-14 Thread Manuel M T Chakravarty
Ryan Newton: But, anyway, it turns out that my example above is easily transformed from a bad GHC performance story into a good one. If you'll bear with me, I'll show how below. First, Manuel makes a good point about the LLVM backend. My 6X anecdote was from a while ago and I didn't

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-12 Thread Gregg Lebovitz
Chris, Thanks you for indulging me. I will eventually get use to the idea that there is a wiki page for almost every topic :-) Gregg On 5/12/2012 1:02 AM, Chris Wong wrote: On Sat, May 12, 2012 at 12:41 AM, Gregg Lebovitzglebov...@gmail.com wrote: I would find it useful to pull all this

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-12 Thread Ertugrul Söylemez
Gregg Lebovitz glebov...@gmail.com wrote: Ryan writes: With a few years of Haskell experience in my backpack I know how to utilize laziness to get amazing performance for code that most people would feel must be written with destructively updating loop. That was me actually. Just a minor

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-11 Thread Gregg Lebovitz
This is an outstanding discussion. I am learning a lot from it. I would find it useful to pull all this information together into a single document that discusses all the performance issues in one place and shares the real life experience is dealing with each issue.

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-11 Thread Chris Wong
On Sat, May 12, 2012 at 12:41 AM, Gregg Lebovitz glebov...@gmail.com wrote: I would find it useful to pull all this information together into a single document that discusses all the performance issues in one place and shares the real life experience is dealing with each issue. I see this as a

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-10 Thread Ryan Newton
through the trouble of writing my algorithms in C/C++, but simple-minded people often have a desire to get the best performance possible, in which case you really want to use C, C++, Fortran or whatever high level assembler language you like. I think this is a bit of an unfair accusation

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-10 Thread Manuel M T Chakravarty
Ryan Newton: As a community I think we have to face the fact that writing the hot inner loop of your application as idiomatic Haskell is not [yet] going to give you C/Fortran performance off the bat. Though in some cases there's not really anything stopping us but more backend/codegen work

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-10 Thread Ertugrul Söylemez
Ryan Newton rrnew...@gmail.com wrote: I think this is a bit of an unfair accusation (simple-minded). Performance is only relevant to certain domains, sure. But program performance is an entire *industry*. And I'd argue it's of massive importance to the world at large. Intel has an army of

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-08 Thread Yves Parès
One thing that baffles me is the comparison Haskell V. Java: http://shootout.alioth.debian.org/u32/benchmark.php?test=alllang=ghclang2=java Would've expected always shorter code and better performances on average. 2012/5/8 Silvio Frischknecht silvio.fris...@gmail.com -BEGIN PGP SIGNED

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-08 Thread Simon Marlow
On 06/05/2012 07:40, Janek S. wrote: a couple of times I've encountered a statement that Haskell programs can have performance comparable to programs in C/C++. I've even read that thanks to functional nature of Haskell, compiler can reason and make guarantess about the code and use that

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-08 Thread Daniël de Kok
On May 8, 2012, at 12:18 PM, Yves Parès wrote: Would've expected always shorter code It's not so surprising if you consider that some of the programs are practically imperative programs in Haskell. To give an example:

[Haskell-cafe] Can Haskell outperform C++?

2012-05-08 Thread Isaac Gouy
2012/5/8 Silvio Frischknecht Also I challenge anyone to improve one of the haskell programs there. It'd be cool if we could make haskell get a higher rank. I recently managed to improve the Fasta algorithm, but not by much. Also I think the benchmarks don't use llvm flag. It says somewhere

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-07 Thread Silvio Frischknecht
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Can anyone provide a code in Haskell that performs better in terms of execution speed than a well-written C/C++ program? http://shootout.alioth.debian.org/ compares a lot of programming languages on a lot of problems. Haskell is never as fast as

[Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Janek S.
Hi, a couple of times I've encountered a statement that Haskell programs can have performance comparable to programs in C/C++. I've even read that thanks to functional nature of Haskell, compiler can reason and make guarantess about the code and use that knowledge to automatically

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Ivan Lazar Miljenovic
On 6 May 2012 16:40, Janek S. fremenz...@poczta.onet.pl wrote: Hi, a couple of times I've encountered a statement that Haskell programs can have performance comparable to programs in C/C++. I've even read that thanks to functional nature of Haskell, compiler can reason and make guarantess

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Artur
On 06.05.2012 10:44, Ivan Lazar Miljenovic wrote: On 6 May 2012 16:40, Janek S.fremenz...@poczta.onet.pl wrote: Hi, a couple of times I've encountered a statement that Haskell programs can have performance comparable to programs in C/C++. I've even read that thanks to functional nature of

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Yves Parès
I do not agree: the fib function is tail-recursive, any good C compiler is able to optimize away the calls and reduce it to a mere loop. At least that's what I learnt about tail recursion in C with GCC. 2012/5/6 Artur apeka1...@gmail.com On 06.05.2012 10:44, Ivan Lazar Miljenovic wrote: On 6

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Roman Cheplyaka
It is not tail-recursive. * Yves Parès yves.pa...@gmail.com [2012-05-06 10:58:45+0200] I do not agree: the fib function is tail-recursive, any good C compiler is able to optimize away the calls and reduce it to a mere loop. At least that's what I learnt about tail recursion in C with GCC.

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Yves Parès
Sorry sorry sorry ^^ I read too fast and realized I was wrong before you sent this. Okay so then it would be nice that somewhere with higher skills tells us where does Haskell recursive calls stand when compared to C's. 2012/5/6 Roman Cheplyaka r...@ro-che.info It is not tail-recursive. *

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Roman Cheplyaka
* Artur apeka1...@gmail.com [2012-05-06 11:41:58+0300] isn't it that particular Haskell code is outperforming C (22 seconds vs. 33), just because the author uses recursion in C? I surely love Haskell, and the way it's code is easy parallelized, but that example seams not fair. I think the

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Austin Seipp
In this case it doesn't matter; while it isn't technically tail recursive, GCC is very capable of transforming it into a direct loop likely because it knows about the associative/commutative properties of + so it's able to re-arrange the body as it sees fit since combined, both calls are in 'tail

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Axel
Well, I believe that comparison is about solving a task, not writing code in some particular way. I get your point, but I think that when comparing language speed, you should use the best techniques each one has to offer, it makes no sense otherwise. If there was some kind of comparison made

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Jerzy Karczmarczuk
Roman Cheplyaka: If you're saying that in C an explicit stack should have been used instead of recursion, then it would increase the code complexity while having non-obvious performance benefits. This is a fragment of a bigger message I won't comment. But THIS is a little dubious. You may

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Ertugrul Söylemez
Janek S. fremenz...@poczta.onet.pl wrote: a couple of times I've encountered a statement that Haskell programs can have performance comparable to programs in C/C++. I've even read that thanks to functional nature of Haskell, compiler can reason and make guarantess about the code and use that

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Ertugrul Söylemez
Roman Cheplyaka r...@ro-che.info wrote: isn't it that particular Haskell code is outperforming C (22 seconds vs. 33), just because the author uses recursion in C? I surely love Haskell, and the way it's code is easy parallelized, but that example seams not fair. I think the point was

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Bartosz Milewski
An equivalent parallel version in C++11 would look something like this: long long fib(long long n) { if (n 2) { return 1; } std::futurelong long r = std::async(fib, n-2); long long l = fib(n-1); return r.get() + l; } My bet though is that it would

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread wren ng thornton
On 5/6/12 2:40 AM, Janek S. wrote: Hi, a couple of times I've encountered a statement that Haskell programs can have performance comparable to programs in C/C++. I've even read that thanks to functional nature of Haskell, compiler can reason and make guarantess about the code and use that