[Haskell-cafe] Re: Re[2]: [Haskell] Google Summer of Code
John Lato
jwlato at gmail.com
Wed Feb 11 15:55:47 EST 2009
On Wed, Feb 11, 2009 at 8:05 PM, Bulat Ziganshin
<bulat.ziganshin at gmail.com> wrote:
> Hello John,
>
> Wednesday, February 11, 2009, 8:54:35 PM, you wrote:
>
>> I know you've talked about performance in the past, and I don't want
>> to start a huge argument, but do you have recent data to back this up?
>> IIRC you're using ghc 6.6, yes?
>
> i don't seen examples of high-performance code written by anyone else
> which would be as simple and as fast as C analogue. afaik ghc now can
> generate good code for tight loops, but gcc optimizations goes far
> beyond this. if you know specialists writing HP code in haskell and
> results of their work - please point us to these code
>
>> I haven't looked at H.264 (and I realize it's compressed, so the
>> situation is different from my work), however ghc can generate very
>> fast code for binary I/O
>
> it's exactly example of tight loop. and let's compare HP code written
> for this task with analogous code written in C. i expect that haskell
> code is much more complex
I think it's fair to point out that tight loops are nearly always the
biggest bottlenecks of code, so generating good code for tight loops
is pretty important. And ghc is still making large improvements with
each release, whereas gcc isn't likely to get significantly better.
>
>> . Check out (shameless self-promotion)
>> http://johnlato.blogspot.com for my recent writeup on creating a
>> high-performance, pure-Haskell, Iteratee-based WAVE file reader.
>
> afaiu, it's 20-line equivalent of 2-line C code:
>
> for (i=...)
> a[i] = b[i]
>
> does this need any more comments?
I think you've misunderstood my code. Look at Oleg's IterateeM and
see if you think that's really all it's doing.
>
> unfortunately, your post doesn't contain equivalent C code and its
> performance measurements, so i can't consider this as argument for
> ghc/gcc comparison. all that i see there is large complex code that
> proves that HP haskell programming is much more complex than C one
Use libsndfile for comparison. http://www.mega-nerd.com/libsndfile/.
I actually haven't looked at the code, although it's very highly
regarded in the audio community (and I've seen the author post on this
list on occasion). Using libsndfile-1.0.18:
wc wav.c
1786 7833 57922 wav.c
compared to my source:
wc Wave.hs
412 2215 15472 Wave.hs
And there you are. I will admit that I have implemented the entire
wave spec, but only because of lack of time.
Cheers,
John
More information about the Haskell-Cafe
mailing list