Dalvik JIT
android-developers.blogspot.com
android-developers.blogspot.com
But yes, we have GC that is fairly responsive these days, too, for when throughput isn't the driving concern.
Really? Colleagues have told me of applications using GC that ran on 486 with good performance.
The popular notions of what dynamic languages and GC are like are literally decades out of whack. This is a self perpetuating phenomenon, which is why you can have popular languages that are between 1 and 2 orders of magnitude slower than they should be. (Outdated GC being a prominent factor.)
Highly responsive UI and relatively low system memory (256MB on the G1) just strikes as quite the feat on top of a GC language. Although you're right, I may just be dating myself.
http://android-developers.blogspot.com/2009/01/avoiding-memo...
It's a different sort of problem, but you have to be careful either way. There is a subtle benefit to having been forced to manage reference counts.
You are 100% with memory management? The problem is not the 99.99% of the time when you do it right. It's the other time when you do it wrong, and debugging that.
Have you actually tracked the time/effort? Can you quantify what memory leaks are costing your project?
Otherwise I am pretty sure that there will be a lot of "great" android apps to be ironic about as well.
There are trade-offs to all decisions. Dalvik performance has been tolerable and now it looks like it has progressed to being quite reasonable.
I'm just waiting for a chance to use a nicer language to produce Dalvik byte-code. I don't think it's very friendly to dynamic languages but I'd settle for almost anything other than Java.
From what I understand Dalvik is also slower for anything involving java.lang.reflect.
So Dalvik is kind of unfriendly to dynamic languages for now. That's OK ... I wish there was some alternative to Java. Scala sucks IMHO.
I could not write Haskell or OCaml code that performs well on Dalvik, because of their allocation profiles.
A language being dynamic does not have much to do with its allocation profile. Haskell and OCaml are not dynamic languages, but have allocation and deallocation profiles that grossly outstrip what you would see in typical Python or Ruby code.
Scala allocates most things on the heap and is probably unsuitable for use on Dalvik. What is your complain about Scala as a language?
You MISS the point ... because everything can change, the semantics are different. A class can change ... first it needs to be garbage-collectible, with one way to do it being for every class to be loaded by a different class loader. Then the methods themselves can change, so in JRuby every method on a class has a corresponding method handler (another class at the VM level).
Even if you write code that doesn't do much, you're programming in Python, not RPython, or in Ruby, not in Duby. You may use a subset of the language, but the interpreter has to be prepared for everything.
I have been following the developments in the JRuby project, and I sincerely doubt that you can write efficient Ruby code on top of Dalvik ;)
> A language being dynamic does not have much to do with its allocation profile.
Again you miss the point ... it does have to do with its allocation profile if you're doing shit that doesn't match the JVM type system. And yeah ... Haskell and Ocaml both have type-systems much more different than those of Ruby/Python.
> Scala allocates most things on the heap and is probably unsuitable for use on Dalvik
So do JRuby or Jython ... AFAIK they don't do tracing compiling, and the JVM doesn't do custom stack-allocated values ... again, hard to match the JVM type system.
On the other hand, Scala uses Java's call semantics, so the generated bytecode is efficient because for runtime-dispatch it follows Java's rules. In a language like Ruby or Python with its own rules about what to call, you need techniques like call-site caching implemented by the language author ... see http://en.wikipedia.org/wiki/Inline_caching ... one issue meant to be solved by InvokeDynamic (whenever Java7 ships).
> What is your complain about Scala as a language?
Too many features thrown in there, some non-orthogonal, just to please the JVM ... and I'm tired of languages with a complex syntax that don't provide a way for library authors to hook in the compiler's pipeline ... you get the worst of both worlds (unreadable code / not capable enough).
I just want a syntax tree from some expression, which would enable me to work/use something like LINQ, or adding to it new syntax when you need it (have a look at Perl's MooseX to see what that can do).
Is that so hard, especially for a language that comes with tons of other features, some of them improperly implemented? (IMHO, type-erased generics in a runtime-dispatch language are totally useless / thrown in there only to have local type inference ... and those manifests are just an ugly hack).
But I already said, it's my opinion ;)