[Haskell-cafe] Re[4]: [Haskell] Google Summer of Code

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Feb 11 16:11:39 EST 2009

Hello John,

Wednesday, February 11, 2009, 11:55:47 PM, you wrote:

>> 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.

it's important, but doesnt't make whole game. and while i said that
ghc improved tight loops compilation, this doesn't mean that it
becomes the same as in gcc. it just started to put loop variables into

> And ghc is still making large improvements with
> each release, whereas gcc isn't likely to get significantly better.

yes, it's close to perfect

>> 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.

what else does the code that you've citated? you are wrote that it
just copies 16-bit words into doubles

> Use libsndfile for comparison.  http://www.mega-nerd.com/libsndfile/.

it's one method of miscomparing haskell to C - compare hand-tuned
haskell code with some C code which may be just not optimal. ig you
want to make fair comparison, you should write best code in both

> 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.

when you don't need speed, you may write more compact code in haskell
than in C. so the best way is to split your task into
speed-critical part and the rest and use C++ for the first and Haskell
for the second

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list