This is what I used to think about JIT as well. That JIT would have more information than a static compiler to optimise the code better. However, it seems to me that most of the performance depends on how well we can exploit the cache lines and how many fewer instructions the cpu has to execute to get the job done. JIT could perhaps improve on the latter but in many cases it seems to me that it's generally very hard to be cache aware when programming in Java not to mention every user-defined type is allocated on heap. So, I feel like it's quite unlikely that there can be Java programs that outperform C and even then that it can't in principle be done better in C.
Yeah I don’t disagree with you, I was really trying to dispel the idea that somehow the implementation language puts an upper limit on the performance of the implemented language.
So, consider a perfectly spherical Java language… :)
Actually, Java gets ridiculously close to C performance when you only do computations on primitives. Of course you do have some pointer chasing in most code bases but in my experience cache is mostly relevant for repetitive workloads. I’m not sure that a typical web application would win all that much from a C rewrite.