Why JIT compilation and not full compilation?
I was viewing a presentation about Android's VM JIT compilation process (quite good). I am far from an expert on the subject but the whole scheme struck me as a bit odd, so it is obvious that I am missing something (probably a few things).
My question is why not compile fully in native code the whole application once it is on the targeted platform? The answer I find is that it would take too much time to load, which makes sense. But what I am missing here is why would you need to compile every time you load the application and not just once for its lifetime?
That made me think also if it would be possible just to have "platform compilation", so you send bytecode to the user and it compiles to native code as part of the installation on the targeted device, provide that you really want to gain performance but yet for what the application to remain device independent. During the particular presentation it showed that most of the code is already practically native and that the JIT compilation time is relatively small. Applications processes are also rarely kill in the Android platform so overall the argument of slow loading time (made during same presentation) is not really self explanatory. I mean if the application needs to load files, network resources etc etc then maybe it is even better to give some time to the loading procedure to be compiled natively to do all this a bit faster.