Re:How Scala Compiles to Java
by kikibobo69 on Tuesday September 21, 2010 @09:21AM
(#1712479)
Unfortunately "as good or better" performance is not realized yet, at least not at theThe Computer Language
Benchmarks Game[1]. More code, more time, more memory required by Clojure than Scala, to solve the same problems.
However the Clojure implementations on the site are still quite young, so some improvement may be possible.
[1] http://shootout.alioth.debian.org/u32/benchmark.php?test=all...
Re:How Scala Compiles to Java
by loewenskind on Tuesday September 21, 2010 @10:38AM
(#1712724)
My point was that it isn't the typing that makes it fast. Hotspot is based on the idea that the type is known at runtime.
The Shootout probably wont show good results for this because it takes a little bit for Hotspot to get the most out of it. If you look at the Mandelbrot demo in Strongtalk it takes about 3 full runs to get the best speed.
Re:How Scala Compiles to Java
by kikibobo69 on Tuesday September 21, 2010 @11:57AM
(#1713053)
Either I don't understand, or you are mistaken. Clojure is significantly slower than Java and Scala in the shootout. Presumably Hotspot kicks in, or doesn't, more or less equivalently in all 3 cases. The dynamic languages (Clojure, Groovy, JRuby) are all slower than the statically typed languages (Java, Scala); what else would cause that?
This raises an interesting question for igouy: there are dozens of jvm knobs you can pull to optimize each benchmark: "-server", "XX:MaxInlineSize", the many "XX" options to play with GC etc. I'm assuming that the same settings would be used for java, scala, and groovy for any single benchmark, but are these switches tuned for that particular benchmark, or the same used for all benchmarks?
Re:How Scala Compiles to Java
by loewenskind on Wednesday September 22, 2010 @03:24AM
(#1715439)
>what else would cause that?
How much work the code that they generate does. Clojure is mostly pure right? If you have, e.g. a btree and you change some nodes the old notes won't get deleted, a new tree will be created where some of the nodes point to the still valid old ones and some point to your changes. That's more work then just mutating the variables.
Re:How Scala Compiles to Java
by therockhead on Tuesday September 21, 2010 @05:37PM
(#1714192)
Clojure is using a lot more memory, any idea why that is?
Uh, why? Are all object types known at runtime in Clojure? I bet they are. And this is exactly what Hotspot was designed to make fast [1].
[1] http://www.strongtalk.org