Since Android applications run on a JVM (Dalvik VM) which is basically a virtual processor, and every virtual instruction has to be mapped to the underlying chipset's native instruction, does this mapping result in more power consumption due to the overhead of this mapping?
This question can be extended to Java and also be phrased as "do Java applications use more power ?". Is this why Android phones have such appalling battery lives as compared to other platforms/phones ?
Edit: Based on the answers I've clarified a few points because I had erroneously spoken of JVM and Dalvik interchangeably. In this bit I'm talking about Java only to ask if it uses more power and if yes, does that conceptually apply to Android as well and does it result in decreased battery life.
Context: quoted from Wikipedia:
- Java bytecode is analogous to assembly language for C code.
- From the viewpoint of a compiler, the Java virtual machine is just another processor with an instruction set, Java bytecode, for which code can be generated.
- JVM has a stack architecture. Dalvik is a process virtual machine which is not the same type of virtualization as JVM and has a register architecture.
Since Java programming language gets compiled to bytecode (assembly-like) and it runs on a virtual processor, it provides for true software code portability. Also, since there is a JVM for Linux and Linux has been ported onto open hardware, the combination can provide true application portability across the entire stack.
Power: The question essentially boils down to this - for the same set of functionality of your software code or application, what percentage of your CPU clock cycles are attributed to the run time environment. This is with the Just-In-Time compilation environment of modern JVMs where if the bytecode is compiled to the underlying chipset's native instruction, then the run-time should only be active during jit compilation. So how much more CPU clock cycles are used up in having the run-time environment which is expected to result in a power consumption overhead. I'm interested only in the power consumption aspect, and not the relative performance compared with statically typed and built languages and understand the advantages of Java. Sub-questions which might be related:
- Does the Java Run time use the libc for it's functionality?
- Do any of these power consumption related points translate to the Dalvik VM and Android?
- Instead of generalizing the poor battery consumption of Android without talking about the screen and wireless chipsets - lets talk about how the iPhone 5 has a 1440 mAH battery which is tiny compared to modern Nexus phones. This whole train of thought (Java, Virtual processor, instruction mapping, Android) arose because an iphone-loyalist friend claimed this could be the likely reason for his iphone having better battery life than my (awesome) nexus.
In any case, thanks for the answers below.