Skip to content

Comment on PyPy faster than C (on a carefully crafted example)

Comments

"I added a printf("%f\n",a) to the end of the file so the compiler wouldn't optimize the whole thing away. On my Cure 2 Duo 2.33Ghz, I got for gcc -O3:

1000000000.000000

real 0m4.396s user 0m4.386s sys 0m0.007s

and for gcc -O3 -flto -fwhole-program:

1000000000.000000

real 0m1.312s user 0m1.308s sys 0m0.003s"

Yet another case of somebody thinking they're making a clever comparison by forgetting to set their compiler flags properly.

Please elaborate on what the correct flags would be, for those of use who wouldn't know.

Try reading the comment I just quoted.

Oh, oops. Sorry, me and at least 3 others had a collective brain fart it seems. I had first thought you meant that both of those sets of compiler flags weren't quite right.

Doesn't work if you're using a shared library, though.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.