Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would you improve Dalvik? Android's Virtual Machine

I am currently writing a paper on the Android platform. After some research, it's clear that Dalvik has room for improvement. I was wondering, what do you think would be the best use of a developer's time with this goal?

JIT compilation seems like the big one, but then i've also heard this would be of limited use on such a low resource machine. Does anyone have a resource or data that backs this up?

Are there any other options that should be considered? Aside from developing a robust native development kit to bypass the VM.

For those who are interested, there is a lecture that has been recorded and put online regarding the Dalvik VM.

Any thoughts welcome, as this question appears subjective i'll clarify that the answer I'll accept must have some justification for proposed changes. Any data to back it up, such as the improvement in the Sun JVM when it was introduced, would be a massive plus.

like image 337
gav Avatar asked Jun 21 '09 09:06

gav


People also ask

What is a Dalvik virtual machine and explain how it works?

Dalvik Runtime Virtual Machine converts bytecode every time the application launches. On the other hand, Android Runtime converts the bytecode only once at the time of installation of application. It is a stable and time-tested virtual machine. It is highly experimented and new. DVM is the choice of Android developers.

What is Dalvik virtual machine in mobile application development?

Dalvik is a discontinued process virtual machine (VM) in Android operating system that executes applications written for Android. (Dalvik bytecode format is still used as a distribution format, but no longer at runtime in newer Android versions.)

What is role of Dalvik in Android development?

Dalvik plays an important role in the development of Android. It acts as a virtual machine where the Android application runs. It is with the help of Dalvik only that devices can execute multiple virtual machines effectively along with better memory management.


2 Answers

  1. Better garbage collection: compacting at minimum (to eliminate memory fragmentation problems experienced today), ideally less CPU intensive at doing the collection itself (to reduce the "my game frame rates suck" complaints)
  2. JIT, as you cite
  3. Enough documentation that, when coupled with an NDK, somebody sufficiently crazy could compile Dalvik bytecode to native code for an AOT compilation option
  4. Make it separable from Android itself, such that other projects might experiment with it and community contributions might arrive in greater quantity and at a faster clip

I'm sure I could come up other ideas if you need them.

like image 167
CommonsWare Avatar answered Oct 25 '22 17:10

CommonsWare


  1. JIT. The stuff about it not helping is a load of crap. You might be more selective about what code you JIT but having 1/10th the performance of native code is always going to be limiting

  2. Decent GC. Modern generational garbage collectors do not have big stutters.

  3. Better code analysis. There are lot of cases where allocations/frees don't need to be made, locks held, and so on. It allows you to write clean code rather than doing optimizations that the machine is better at

In theory most of the higher level languages (Java, Javascript, python,...) should be within 20% of native code performance for most cases. But it requires the platform vendor to spend 100s+ developer man years. Sun Java is getting good. They have also been working on it for 10 years.

like image 20
hacken Avatar answered Oct 25 '22 18:10

hacken