Hacker News new | ask | show | jobs
by lorenzhs 3380 days ago
That the C code is compiled with "gcc -O7" tells me just about everything I need to know about the soundness of these experiments. "-O3" and "-Ofast" are the highest optimisation levels, where "-Ofast" includes optimisations that break some standard-compliant programs (mostly -ffast-math).

Not to mention that comparing running times for a single run on an unspecified machine isn't "benchmarking".

2 comments

"Faster than C" will be bogus 99.9% of the time no matter how fake or stupid your "benchmark" is.
Yeah, it's hardly a benchmark. The information what kind of CPU they are using is also missing (why no -march=native?).

Despite how unbelievable it looks, I would love to see contents of the final binary to see what is really happening there. gcc code looks quite alright in this case: https://godbolt.org/g/R6iBup

My totally unsupported guess is that they detect pure functions and add implicit memoization. It is relative easy to implement, has good benchmark times if N is big enough but not too big to make the trick obvious, but under the hood it use more memory than you expected.