[Haskell-cafe] benchmarking c/c++ and haskell

Vo Minh Thu noteed at gmail.com
Wed Sep 15 06:22:24 EDT 2010


Thanks all for your answsers. I still wonder why some people get very
different results between gcc and ghc, and some others don't. A
difference in processor?

I guess I will crank up a little package using criterion and producing
two executables to make sure anyone who run the benchmark use the same
options, and ease the whole process.

Thanks,
Thu

2010/9/15 Daniel Fischer <daniel.is.fischer at web.de>:
> On Wednesday 15 September 2010 02:50:15, David Terei wrote:
>> On 13 September 2010 20:41, Vo Minh Thu <noteed at gmail.com> wrote:
>> > ... the post is from 2008. No LLVM goodness. So I thought GHC 6.12.1
>> > (not the latest and greatest HEAD) would be enough.
>>
>> I compiled the two programs myself out of curiosity and got the
>> following times.
>>
>> Linux, 64bit, Ubuntu 10.10:
>>
>> 1e8
>> clang: 0.180s
>> gcc: 0.179s
>> ghc 6.12.1 (viac): 0.187s
>> ghc 6.12.1 (fasm): 0.218s
>> ghc HEAD (viac): 0.186s
>> ghc HEAD (fasm): 0.179s
>> ghc HEAD (llvm): 0.174s
>>
>> 1e9
>> clang: 1.657s
>> gcc: 1.647s
>> ghc 6.12.1 (viac): 1.653s
>> ghc 6.12.1 (fasm): 1.975s
>> ghc HEAD (viac): 1.648s
>> ghc HEAD (fasm): 1.658s
>> ghc HEAD (llvm): 1.646s
>>
>> So basically all have the same time except ghc 6.12.1 where fasm is a
>> little slow.
>>
>> On windows xp 32bit I get quite different results which I trust less
>> as the times are jumping around much more then they were on linux:
>>
>> 1e8
>> gcc: 0.365s
>> ghc 6.12.1 (viac): 5.287s
>> ghc 6.12.1 (fasm): 1.332s
>> ghc HEAD (viac): 5.292s
>> ghc HEAD (fasm): 0.875s
>> ghc HEAD (llvm): 0.359s
>>
>> Not sure why the results on windows are so different.
>
> I have no idea why, but I remember that on several occasions timings for
> via-C compiled programmes on Windows have been abysmal.
> Whether it's a general Windows/gcc mismatch or something GHC-specific, I've
> no idea (and can't find out, not having Windows).
>
> For what it's worth, the approximate timings on my 32-bit linux (openSUSE
> 11.1) box have been
>
> 1e8
> gcc: ~0.4s
> 6.12.3 (viac): ~1.2s
> 6.12.3 (fasm): ~2.7s
> HEAD the same as 6.12.3
>
> (I have deleted the programmes and I don't remember the exact timings, if
> you're interested, I could reconstruct them).
>
>> If anyone else
>> wants to run the two programs on Windows and check that would be
>> great.
>>
>> Cheers,
>> David
>
>


More information about the Haskell-Cafe mailing list