Java is not necessarily slower than C++. In some cases it could even be faster due to dynamic optimizations performed by JIT based on runtime profiling information. For example, JIT can directly link or even inline polymorphic calls automatically at runtime.