

The Power of the JVM - luckystrike
http://headius.blogspot.com/2008/05/power-of-jvm.html

======
systems
it would be nice if arc was to be implemented on the JVM, it will be instantly
portable, easy to install .. both of which can boost arc's popularity and
adoption

~~~
icey
Have you taken a look at Clojure yet? <http://clojure.org/>

------
mosburger
Cool! Does anyone know if Scala uses a similar call site cache technique?

I think the death of the JVM has been greatly exaggerated. :)

~~~
allertonm
Since Scala is a compiled statically typed language and not an interpreted
dynamic one, this technique is not necessary. Where this technique is useful
is cases where the method being called is impossible to know until runtime,
such as in Ruby or Groovy. Scala, like Java, is not like this and the compiler
can be guaranteed to have enough information to generate the right bytecode
for the call inline.

The key difference between Scala and Java here is that because Scala uses type
inferencing at compile time, the programmer has to provide a lot less of that
information than they would in the equivalent Java code.

~~~
mattrepl
>Where this technique is useful is cases where the method being called is
impossible to know until runtime, such as in Ruby or Groovy. Scala, like Java,
is not like this and the compiler can be guaranteed to have enough information
to generate the right bytecode for the call inline.

What about polymorphic method calls? Statically typed or not, which method
implementation to invoke is impossible to know until runtime.

[http://en.wikipedia.org/wiki/Polymorphism_in_object-
oriented...](http://en.wikipedia.org/wiki/Polymorphism_in_object-
oriented_programming#Java)

~~~
allertonm
While the actual implementation method that will be invoked is unknown, in a
statically typed language the base class/interface and the _method signature_
are known. In Java/Scala classes the types of the arguments are baked into the
method names used by the bytecode so this is important information from a
performance point-of-view.

Looking up this information at run-time (via reflection) is slow, but dynamic
languages on the JVM have have been forced to do that when calling into Java
classes from the dynamic language - which is the starting point of the
original article.

Scala is not affected by this because it is not a dynamic language and the
Scala compiler has the exact same information that the Java compiler does when
it compiles a call from Scala to Java.

