It is impossible for one language to be faster than another language, period.
A programming language is a set of abstract mathematical rules and restrictions. It is an idea. A piece of paper. You cannot run a language, therefore, you cannot measure its performance.
What you can do is run a particular piece of code written in one language using a particular version of a particular implementation of that language with a particular set of command line flags in a particular environment and compare its performance to a different piece of code written in a different language run with a different version of a different implementation configured with a different set of flags in a different environment.
But with all those differences, it will then be impossible to tell which of all of those differences actually caused the difference in performance. Was it the different benchmark programs? The different configuration options? The different versions? The different implementations? The different environments? Was the difference in performance caused by the language or by the quality of the implementations? Was it maybe caused by the difference in how much money was invested in optimizations?
I am willing to bet that for every set of environments and implementations that you can present me where language A is faster than language B, I can find a different set of environments and implementations where for the same two pieces of code, language B outperforms language A.
For example, there are Java implementations that are really fast. There are C++ implementations that are really slow. All I need to do is run my benchmarks using those two implementations, and I will have "proven" that Java is much faster than C++.
In the YARV Ruby VM, the Hash
class is implemented in C. In the Rubinius Ruby VM, the Hash
class is implemented in Ruby. Benchmarks that make heavy use of Hash
es run faster on Rubinius than on YARV. Does that prove that Ruby is faster than C?