This is the eternal debate between Java developers and C/C++ programmers. Each group, convinced that their language is the fastest, will heartily argue with its fellows for hours.
Can we really compare though? What tests would we do? In which environment?
Do you know what makes your language faster and in which case?
Cliff Click gave a talk on this subject at QCon San Francisco. He discussed the strengths and weaknesses of both languages and the programming context surrounding their choice.
C/C++ will be better than Java in these cases:
- Footprint (ex: embedded controllers)
- Reboot time (ex: pacemakers)
- Arrays reshaping is hard to do in Java
- Value types
- Direct machine access (ex: device drivers, FPS games)
- Direct code generation
- Destructors versus finalizers
- Destructors versus try/finally
On the other hand, Java will beat C/C++ in these cases:
- Very large programs
- Garbage collection
- Tools for parallel coding and debugging
The differences between the two programming languages can be linked to their history as they’ve been designed for different purposes.
Most often than not, the comparison between both languages will use wrong arguments. At the end of the day, which language is faster?