Quote:Original post by meeshoo
so explain to me, please, how can an OOP code JIT compiler be faster than a C compiler.
It can be faster because a JIT compiler compiles native code specifically for the platform it's running on. Since C/C++ is precompiled, programs need to be compiled for the worst possible scenario (IE: I don't know what platform my customer will have, so I compile it using only Pentium instructions with no MMX or SSE instructions, that way I can be sure it will run on most platforms - Pentium or later at least). Now, a user with a Pentium 4 MMX and SSE2 enabled processor buys my program. My program is going to waste a lot of cycles because it doesn't take advantage of that user's superior processor. Those cycles could be put to better use - producing higher resolution graphics or a nicer user interface.
This is why a JIT compiler can produce better code than a pre-compiler. The JIT compiler is running on the exact machine that the code will be executed on, so it can easily tell how broad of an instruction set it should use, literally producing code custom tailored for the user's system.