[Haskell-cafe] Haskell performance question

Thomas Schilling nominolo at googlemail.com
Thu Nov 8 19:39:55 EST 2007


On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote:
> On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote:
> > 
> > $ ghc --make -O2 ghc-bench.hs
> > 
> > and got:
> > 
> > $ time ./ghc-bench 
> > 2.0e7
> > 
> > real    0m0.714s
> > user    0m0.576s
> > sys     0m0.132s
> > 
> > $ time ./ghcbC 
> > 20000000.000000
> > 
> > real    0m0.305s
> > user    0m0.164s
> > sys     0m0.132s
> > 
> > This is on a first-gen Macbook running Ubuntu.  1GB RAM.  1.83Ghz Core
> > Duo
> > 
> > $ ghc --version
> > The Glorious Glasgow Haskell Compilation System, version 6.8.0.20071019
> > 
> > $ gcc --version
> > gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
> > Copyright (C) 2006 Free Software Foundation, Inc.
> > This is free software; see the source for copying conditions.  There is
> > NO
> > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> > PURPOSE.
> > 
> > 
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> > $ gcc -O3 ghc-bench.c -o ghcbC
> > ghc-bench.c: In function ‘main’:
> > ghc-bench.c:16: warning: incompatible implicit declaration of built-in
> > function ‘printf’
> 
> -O3 is worse than -O0, DO NOT USE IT.
> 
> I reported the bug several months ago.  In the meantime, use -O2.
> 
> (there are no high optimizations, it's just that the option parser
> misparses -O3)
> 
> Stefan

Even for GCC (/not/ G_H_C)?  I know about the GHC bug, that's why I used
-O2 for GHC/Haskell and -O3 for GCC/C.

/Thomas



More information about the Haskell-Cafe mailing list