[Haskell-cafe] GHC vs GCC

Xiao-Yong Jin xj2106 at columbia.edu
Sat Mar 27 11:09:09 EDT 2010


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 helped tons - it isn't GHC thats at fault
> here and yes it does tco.  I attached a version w/ excessive bangs
> below.  Did you compile with "ghc --make -O3 -fforce-recomp"?

I can verify that it is not bang patterns that helped, it is
an issue related to `mod' vs. `rem'.

mod w/o bang: 30.73s user 0.15s system 99% cpu 30.954 total
rem w/o bang: 6.52s user 0.00s system 99% cpu 6.528 total
mod w/  bang: 30.53s user 0.25s system 99% cpu 30.878 total
rem w/  bang: 6.34s user 0.00s system 99% cpu 6.359 total

Compiled with:
  ghc --make -fexcess-precision -funbox-strict-fields -O3 -Wall -optc-O3 -optc-march=native -optl-Wl,-s -fvia-c -fforce-recomp test.hs -o test-hs

And for comparison, c version: 4.35s user 0.04s system 99% cpu 4.403 total

Linux 2.6.33-ARCH #1 SMP PREEMPT Mon Mar 15 19:11:52 CET 2010 x86_64 GenuineIntel GNU/Linux

Best,
jxy
-- 
J    c/*    __o/*
X    <\     * (__
Y    */\      <


More information about the Haskell-Cafe mailing list