17

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.

Seki
  • 11,135
  • 7
  • 46
  • 70
gav
  • 29,022
  • 23
  • 65
  • 90
  • 1
    How can you state in a paper that : "it's clear that Dalvik has room for improvement" without knowing what that rooms are. Giving away JIT compilation is much : all interpreted language would benefit from it. What else did you notice ? – Bite code Jun 21 '09 at 09:45
  • Apologies, I should have clarified further. First, when i say paper, this is more of a preliminary to my paper and hence does not need to be as formal as a published thesis. Second, if you click the research link in the above text you'll see a couple of my early results. What I'm getting at is that Dalvik is far from as fast as Native code, comparing to JVM on a desktop, there is room for improvement. Also having watched the Dalvik VM talk, the other link above, the designers acknowledge that performance isn't optimal. I'd just like some ideas for optimizations not yet implemented on Dalvik – gav Jun 21 '09 at 10:21
  • For those looking at this Q&A today and wondering, earlier versions of Android/Dalvik didn't have JIT. Android 2.2 introduced JIT for Dalvik. Android 2.1 had it in the source code but was disabled in production builds. – HRJ Dec 27 '10 at 12:19

3 Answers3

18
  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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
3
  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.

hacken
  • 2,135
  • 11
  • 11
  • 4
    Your last point highlights the fundamental design flaw of choosing to write Dalvik instead of starting with a established code base. If they chose Mono, they'd be years ahead of where they are now as a platform. – Sam Harwell Apr 12 '10 at 20:54
0

One of the main problems with Dalvik is performance, which is terrible I heard, but one of the things I would like most is the addition of more languages.

The JVM has had community projects getting Python and Ruby running on the platform, and even special languages such as Scala, Groovy and Closure developed for it. It would be nice to see these (and/or others) on the Dalvik platform as well. Sun has been working on the Da Vinci machine as well, a dynamic typing extension of the JVM, which indicates a major shift away from the "one language fits all" philosophy Sun has followed over the last 15 years.

wvdschel
  • 11,800
  • 14
  • 41
  • 45
  • Android now has support for scripting language. It's not much, but will improve : http://stackoverflow.com/questions/101754/is-there-any-way-to-run-python-on-android. – Bite code Jun 21 '09 at 09:44