On Fri, Feb 20, 2009 at 6:39 AM, Dan Doel
<dan.doel@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++?