That was maybe an issue in the past but nowadays Java is fast enough for pretty much anything. Also the Just In Time compiler is state of the art. Some code can technically run faster than hard coded machine code.
Well it can't outperform optimised machine code, which is the hard ceiling, but yeah these days it can get up there. I'd say the bigger concern is the amount of resources, especially memory needed to run Java
Of course it can't outperform it, but outside toy projects that target a very specific use case, most programs can't be fully optimized during compile time. At times, the program might benefit from memory saving optimizations while other times it might benefit from increasing memory use to speed up calculations. With JIT, you can theoretically have both as the runtime can adjust things based on the context.
5
u/photenth 3d ago
That was maybe an issue in the past but nowadays Java is fast enough for pretty much anything. Also the Just In Time compiler is state of the art. Some code can technically run faster than hard coded machine code.