[Haskell-cafe] speed: ghc vs gcc

David Leimbach leimy2k at gmail.com
Fri Feb 20 10:52:03 EST 2009

On Fri, Feb 20, 2009 at 6:39 AM, Dan Doel <dan.doel at gmail.com> wrote:

> Sorry for replying to myself, but I got suspicious about the 6ms runtime of
> the 64-bit C++ code on my machine. So I looked at the assembly and found
> this:
>    .LCFI1:
>            movabsq $499999999500000000, %rsi
>            movl    $_ZSt4cout, %edi
>            pushq   %r12
> I'm no assembly guru, but that makes me think that there's no actual
> computation going on in the runtime for the 64-bit C++ program, whereas the
> 32-bit one is clearly doing work on my system, since it takes around 1
> second.
> Not that I'd be sad if GHC could reduce that whole constant at compile
> time,
> but GCC isn't doing 1 billion adds in 6 (or even 60) milliseconds.

The GCC optimizer must know that you can't return a value to user space of
that large as a return result.

In Haskell you're printing it... why not print it in C++?

> _______________________________________________
> 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/20090220/c2a7d800/attachment.htm

More information about the Haskell-Cafe mailing list