Page 1 of 1

Scala?

Posted: Tue May 31, 2011 4:36 am UTC
by OOPMan
Anyone else been looking at learning this?

I'm not a big fan of Java but Scala (Along with Clojure) put the JVM to a better use IMHO...

Re: Scala?

Posted: Tue May 31, 2011 1:04 pm UTC
by MHD
I'm looking at possibly learning it too.

The other candidates on my list are: Erlang, SML and FORTH

Re: Scala?

Posted: Tue May 31, 2011 1:13 pm UTC
by Berengal
I personally think Clojure is better than Scala, but it's certainly an interesting language. Better than Java by far.

Re: Scala?

Posted: Tue May 31, 2011 3:09 pm UTC
by thoughtfully
MHD wrote:I'm looking at possibly learning it too.

The other candidates on my list are: Erlang, SML and FORTH

If you're considering Forth, you might want to look into a more modern stack-based language, such as Factor.

Re: Scala?

Posted: Fri Jun 03, 2011 3:48 pm UTC
by OOPMan
Berengal wrote:I personally think Clojure is better than Scala, but it's certainly an interesting language. Better than Java by far.


Well Clojure is a LISP so it figures that it's a better language :-)

Re: Scala?

Posted: Tue Jun 07, 2011 5:22 am UTC
by bytbox
Berengal wrote:Better than Java by far.

Oh, that's hard.

I've been looking at learning scala or erlang. (By which I mean, scala and erlang, and I haven't decided the order.) The thought of having to deal with the JVM makes me sick, though - I hope openjdk is more stable these days...

Re: Scala?

Posted: Tue Jun 07, 2011 5:36 am UTC
by EvanED
The JVM is actually a decent enough platform. With the exception of the lack of tail call support, it's pretty much the best VM out there from what I can tell.

Re: Scala?

Posted: Tue Jun 07, 2011 6:41 pm UTC
by Berengal
EvanED wrote:The JVM is actually a decent enough platform. With the exception of the lack of tail call support, it's pretty much the best VM out there from what I can tell.
I think that both the CLR and Dalvik are better VMs. The JVM is actually rather primitive. What's good about it are the various highly mature, highly optimized implementations, although these vary from platform to platform as well. For example, I don't think there's any JVM implementation that beats Dalvik on the platforms that it runs natively on. I've yet to see a comparison between any JVM and the microsoft CLR implementation, but Mono is about half the speed of hotspot (comparing Java and C# programs) and I suspect microsoft's implementation is better while hotspot may be slower on windows than on linux.

Re: Scala?

Posted: Tue Jun 07, 2011 7:37 pm UTC
by korona
Berengal wrote:
EvanED wrote:The JVM is actually a decent enough platform. With the exception of the lack of tail call support, it's pretty much the best VM out there from what I can tell.
I think that both the CLR and Dalvik are better VMs. The JVM is actually rather primitive. What's good about it are the various highly mature, highly optimized implementations, although these vary from platform to platform as well. For example, I don't think there's any JVM implementation that beats Dalvik on the platforms that it runs natively on. I've yet to see a comparison between any JVM and the microsoft CLR implementation, but Mono is about half the speed of hotspot (comparing Java and C# programs) and I suspect microsoft's implementation is better while hotspot may be slower on windows than on linux.

CLR has almost the same architecture as the JVM. It's also stack based. The only difference I can think of is that it supports unsigned integers and interaction with native code. EDIT: IIRC CLR supports stack allocated objects. Hotspot is very good at dealing with short lived objects; newer versions of Hotspot also support escape analysis. (Personally I don't like the CLR assembly file format and its embedding into PE as the spec is _very_ complex)

Hotspot has a much better JIT and garbage collector than Dalvik. Dalvik obviously shares the JVM's type system. The only reason that Google uses Dalvik is that Hotspot has a huge memory footprint. Could you state any reasons why you think that Dalvik and CLR are better virtual machines?

Re: Scala?

Posted: Tue Jun 07, 2011 8:58 pm UTC
by Berengal
The CLR has stack-allocated objects and parameterized types. Dalvik is a register machine, which is just nicer to work with overall. Also, Dalvik's executable format is supperior to the JVMs.

korona wrote:Hotspot has a much better JIT and garbage collector than Dalvik.
Do you have any benchmarks for that? I've been looking for some, but I haven't even found any indication that they both run on the same hardware yet.

Re: Scala?

Posted: Tue Jun 07, 2011 10:31 pm UTC
by EvanED
Berengal wrote:The CLR has stack-allocated objects and parameterized types. Dalvik is a register machine, which is just nicer to work with overall. Also, Dalvik's executable format is supperior to the JVMs.

korona wrote:Hotspot has a much better JIT and garbage collector than Dalvik.
Do you have any benchmarks for that? I've been looking for some, but I haven't even found any indication that they both run on the same hardware yet.

I haven't seen comparisons of the actual .Net VM and the JVM, but I suspect that even if the CLR is better in theory (because of those benefits you mention, though I'm not sure that stack-allocated objects count) the actual implementation wouldn't measure up.

Maybe I'll try to do some experiments some time. Any suggestions for benchmarks to try?

Re: Scala?

Posted: Thu Jun 09, 2011 7:50 pm UTC
by korona
Hotspot has much greater optimizations than Dalvik; I don't know any research papers on this topic but you can look at the code & documentation of both vms. Dalvik's compiler is still _very_ young. (There is a comparisons of Mono, Dalvik and Hotspot (ie. modified versions of Mono and Hotspot that run on mobile phones). It seems that Mono is pretty fast among those vms but I don't think anyone actually verified the results of that author. The author also uses an outdated version of Dalvik with no compiler. Here is the link: http://www.koushikdutta.com/2009/01/dalvik-vs-mono.html)

Dalvik is optimized for low memory footprint and not for great performance optimizations; so is its bytecode file format.
I don't think that register based vms have advantages over stack based ones; being register based does not free the compiler to do actual register allocation; it does not even make it easier. (It don't recall how it CLR restricts the usage of the operand stack but the JVM puts constraints on the types that are pushed on the stack ie. the type of values passed to basic blocks must be equal at each branch refering to this block) Almost all "heavy" optimizations will need a data flow graph that can be easily be obtained from both representations. In particular Dalviks 4 bit register index format sucks and forces it to move data between registers regulary just to keep the file size low.