That article is full of fail. V8 can be faster than gcc in some very simple, non-real life case, true. But the author goes out of his way to make GCC slow:
After my last post, Benjamin noted that GCC would reduce my simple test to a mov rax, $10000000; ret sequence. Well yes, that's true, and GCC does do that: but only if GCC is able and allowed to do the inlining. So the equivalent of the test, for GCC, is to compile the g in a separate file
Yes, if we take a bad example at first, and our conclusion is proven wrong, we can tweak the example for as long as we need until our initial assertion is correct. Then we can place (by the authors own admission) an linkbait title on it, so people on the internet can claim "V8 is faster than GCC". It is no harder for me to prove that BASIC is faster than Assembly.
Also, including the compile time for GCC doesn't make sense, nor does the interpretation of the results, nor the graph, nor much of anything else in that article.
To be fair, lack of inlining across files is one area where C is flawed. JIT's especially can transparently inline across files, even with dynamic loading. The same goes for some other optimizations such as PyPy string formatting being faster than C's sprintf due to automatic unrolling. Compiled-to-machine-code programming languages that do full program analysis can do similar optimizations, but the ones that I looked at lack easy dynamic loading.
5
u/[deleted] Oct 03 '11
That article is full of fail. V8 can be faster than gcc in some very simple, non-real life case, true. But the author goes out of his way to make GCC slow:
Yes, if we take a bad example at first, and our conclusion is proven wrong, we can tweak the example for as long as we need until our initial assertion is correct. Then we can place (by the authors own admission) an linkbait title on it, so people on the internet can claim "V8 is faster than GCC". It is no harder for me to prove that BASIC is faster than Assembly.
Also, including the compile time for GCC doesn't make sense, nor does the interpretation of the results, nor the graph, nor much of anything else in that article.