Fascinating discussion on Java and C++ performance (if you can just skip the noise!) at Slashdot. I especially liked the following entries:
- Measurements are for compilers and/or JVMs, not languages: Yes, different JVMs have different performance characteristics and different compilers do different level of optimizations. Though, with time, they tend to converge.
- Java facilitates optimization at the macro level: Low level languages such as Assembly and C support runtime efficiency at machine instruction level whereas VM based languages like Java (and C#!) support optimization by doing certain tasks (such as GC) when the system is less loaded. Potential of dynamic optimization based on runtime analysis also favors VM based languages.
- Given sufficient will (and time), it is possible to optimize C++ code run faster than Java: Includes optimized code for hash table lookups and the measurement times.
- Which language is faster -- depends on workload: and also how your program handles that workload.
- Inlining in Java: JVM indeed has more information to do better inlining and hence reduce the method call overhead.
- Optimize your Java App: Don't rely on JVM for all the optimizations. Application architecture and use of efficient libraries are important for Java as well.