in Android

JIT vs AOT at Android

Αs Android from 2.2 uses JIT (Just in time compilation) to fast the execution of it’s applications I questioned myself why they are not using an Ahead of time (AOT) compilation technique.

The answer was quite obvious after reading the following article: Comparing compilation techniques
IBM is quite famous for it’s high quality technical articles.

There are far more benefits at Android’s environment to use JIT than AOT, pointing out a few:

  • Better code quality
  • Exploitation of dynamic behaviors
  • Knowledge of classes and hierarchy
  • Steady-state performance

AOT on the other hand is better at:

  • Start-up time
  • Interactive performance
  • Deterministic performance

Now you may wonder, since applications on Android are quite slow while starting, why the Android engineers did not select the AOT that certainly decreases the start up time cost.

I think the answer to this can be found at the Android’s Stack model. When an Android application starts, it stays at the stack for caching, and it is killed only in need of more available memory, so there is actually need of starting the application once, at the very beginning. More info about the Android’s stack model can be found here: http://developer.android.com/guide/topics/fundamentals.html

More info about the subject can be found here:

http://en.wikipedia.org/wiki/Java_performance

http://en.wikipedia.org/wiki/Just-in-time_compilation

http://en.wikipedia.org/wiki/AOT_compiler

Share