Fwd: [Haskell-cafe] speed: ghc vs gcc

Alberto G. Corona agocorona at gmail.com
Fri Feb 20 19:18:27 EST 2009


I think that a higuer level language has better opportunities to optimize,
specially if the compiler is coded in its own language. for example I guess
that a good type dependent implementation would evaluate
the sum[1..10^9::Int] at compilation time.
I reality haskell is  much much faster than c in some cases that now are not
considered, but it is fair to remember that haskell outperfromed all the
rest in those old benchmarks with did´t care to print the results.  This may
seem trivial now, but at the time surprised the benchmark people.

2009/2/21 Khudyakov Alexey <alexey.skladnoy at gmail.com>

On Friday 20 February 2009 16:29:29 Bulat Ziganshin wrote:
> > Hello haskell-cafe,
> >
> > since there are no objective tests comparing ghc to gcc, i made my own
> > one. these are 3 programs, calculating sum in c++ and haskell:
> >
> > main = print $ sum[1..10^9::Int]
> >
> > ... skipped ...
>
> The discussion is mostly about low level optimizations such as loop
> unrolling
> etc.
>
> I have another question. Why shouldn't compiler realize that `sum
> [1..10^9]'
> is constant and thus evaluate it at compile time?
>
> --
>  Khudakov Alexey
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090221/93918ca4/attachment.htm


More information about the Haskell-Cafe mailing list