Chances are he was talking about this section.
QUOTE
Java is often Just-in-time compiled at runtime by the Java Virtual machine. Hence, when Just-in-time compiled, its performance is generally:
* lower than the performance of compiled languages as C or C++, but not significantly for most tasks,
* close to other Just-in-time compiled languages such as C#,
* much better than languages without an effective native-code compiler (JIT or AOT), such as Perl, Ruby, PHP and Python.
Program speed
The average performance of Java programs has increased a lot over time, and Java's speed is now comparable with C or C++. In some cases Java is significantly slower, in others, significantly faster.
It must also be said that benchmarks often measure performance for small numerically-intensive programs. This arguably favours C. In some real life programs, Java out-performs C, and often there is no performance difference at all. One example is the benchmark of Jake2 (a clone of Quake 2 written in Java by translating the original GPL C code). The Java 5.0 version performs better in some hardware configurations that its C counterpart: 260/250 fps versus 245 fps. While its not specified how the data was measured (for example if the original Quake 2 executable compiled in 1997 was used, which may be considered bad as current C compilers could achieve better optimizations), it notes how the same Java source code can have a huge speed boost just by updating the VM, something impossible to achieve with a 100% static approach.
Also some optimizations that are possible in Java and similar languages are not possible in C or C++:
* C-style pointers make optimization hard in languages that support them.
* Adaptive optimization is impossible in fully compiled code, as the code is compiled once before any program execution, and thus can not take advantage of the architecture and the code path. Some benchmarks show that performance of compiled C or C++ programs are very much dependent on the compatibility of the compilation options on the processor architecture – such as SSE2 for example), although Java programs are JIT-compiled and adapt on the fly to any given architecture.
* Escape analysis techniques can not be used in C++ for example, because the compiler can not know where an Object will be used (also because of pointers).
However, results for microbenchmarks between Java and C or C++ highly depend on which operations are compared. For example, when comparing with Java 5.0:
* 32 and 64 bits arithmetics operations, File I/O and Exception handling, have a similar performance to comparable C programs
* Collections, Objects creation and destruction performance, as well as method calls are much better in Java than in C++. However the test is probably biased against C++ since it creates "dynamic objects" even if C++ can create stack objects while Java can't. Heap allocation is slow in C++ since its a general mechanism that should be used only if really needed.
* Arrays operations performance are better in C.
* Trigonometric functions performance are much better in C.