
10 Feb
2007
10 Feb
'07
1:11 p.m.
On 2/10/07, Felipe Almeida Lessa
Under gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5), the following asm code is generated for part of the main function:
mov dword ptr [esp+4], 0aaaaaaabh mov dword ptr [esp+8], 400aaaaah mov dword ptr [esp], data_804858c call wrapper_8049688_80482b4
where data_804858c is "%f\n" and wrapper_8049688_80482b4 is printf. Needless to say that the other argument is exactly the double 3.3333333333333335. In the OP's words, "newer gcc's will statically compute that loop".
What I found impressive was the time taken by the haskell version, 14s, much more than the haskell and C version of Donald's e-mail.