News for hackers. Stuff that matters.
Re:Develop for Android with Scala by basil on Sunday March 21, 2010 @04:57PM (#1208570)
How is the performance compared to straight Java? I know the Clojure on Android project is at the moment, slower due to the functional nature of the language. Apparently the Dalvik garbage collector has to work overtime cleaning up because of the emphasis on creating new objects rather than mutating existing ones.
Re:Develop for Android with Scala by bad_user on Sunday March 21, 2010 @05:11PM (#1208594)
> I know the Clojure on Android project is at the moment, slower due to the functional nature of the language.

There are two things that can hurt performance for functional languages on top of the Java VMs ... the lack of TCO and the mapping of a type-system that's too different to be mapped efficiently.

In Clojure though what hurts is its dynamic nature, but you can go a long way by using type-annotations when you discover clear bottlenecks.

Re:Develop for Android with Scala by plinkplonk on Monday March 22, 2010 @12:03AM (#1209272)
Is there any reason that the Dalvik VM shouldn't get TCO even if the JVM doesn't? I read somewhere that implementing TCO would necessitate a change in the bytcode and the jvm guys didnt ant to do this to break backward compatibility.

N.B: I haven't investigated the Dalvik VM and/or the Android ecosystem in any great detail, so this might be afoolish question,but any answers appreciated.

Re:Develop for Android with Scala by stephenjudkins on Sunday March 21, 2010 @07:47PM (#1208870)
You can write Java-like code in Scala that compiles down to nearly identical bytecode to the Java version. If you're not using any primitives it will be 100% as fast.

If you write idiomatic Scala code, or use many primitives in Java code, the performance of Scala becomes relatively worse. Every first-class function you use turns into the equivalent of a new class and object at runtime, and the immutable data structures are slower than their Java equivalents.

I'm not sure how the performance delta differs between the JVM and Android's Dalvik VM. It may be that Dalvik's lack of JIT or less efficient garbage collector makes the Scala performance penalty bigger on Android. I would be interested in seeing some benchmarks.

Re:Develop for Android with Scala by stefanrusek on Sunday March 21, 2010 @05:00PM (#1208578)
I have one app in the market that uses it and it runs great.
Re:Develop for Android with Scala by mark_h on Sunday March 21, 2010 @06:07PM (#1208705)
Cool! Which one, out of curiosity?
Re:Develop for Android with Scala by briancooley on Sunday March 21, 2010 @07:23PM (#1208832)