Hacker News new | ask | show | jobs
by kbolino 492 days ago
The general idea is correct, but a rather significant detail is not.

Android did not choose Java bytecode, it chose Dalvik bytecode [1]. This was done for several reasons, but at a high level, Dalvik bytecode more closely matches how real computers work while Java bytecode targets a more abstract virtual machine. This result is that Dalvik bytecode is easier to transform into machine code, and more optimizations are done in the source code -> bytecode phase rather than the bytecode -> machine code phase, relative to Java bytecode.

[1]: https://source.android.com/docs/core/runtime/dalvik-bytecode

1 comments

Thanks for the additional detail, https://en.wikipedia.org/wiki/Dalvik_(software)

> Programs for Android are commonly written in Java and compiled to bytecode for the Java Virtual Machine, which is then translated to Dalvik bytecode.. The successor of Dalvik is Android Runtime (ART), which uses the same bytecode and .dex files (but not .odex files), with the succession aiming at performance improvements.