2012/2/9 Cédric Beust ♔ <[email protected]> > > On Thu, Feb 9, 2012 at 9:49 AM, Kevin Wright <[email protected]>wrote: > >> It's more of an issue with the JVM than it is with scala, > > > If this were true, then the Java version would be as slow as the Scala > version, wouldn't it? >
If it was false then an imperative version in Scala would be slower than an imperative version in Java, and a functional version that suffered boxing/unboxing in Java (using java 8 closures, lambdaj, or guava) would be blindingly fast. That simply isn't the case... > If, like you say, the issue is with boxing, then it's clearly related to > the way Scala does its boxing and it has nothing to do with the JVM. > Boxing is done by using Integer.valueOf() and related methods. This is a facility provided by the platform and is nothing to do with Scala. However, there are efforts underway to work around these limitations. We already have specialisation that can avoid boxing in many cases (at the cost of larger classes with lots of overloading), this is one case where Scala goes against popular misconception and is the faster of the two languages. There's also been some interesting discussion on the mailing lists recently about other ways to take such things even further. > -- > Cédric > > -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
