Linked by Peter Gerdes on Mon 10th Jan 2005 17:35 UTC
Editorial As a recent ACM Queue article observes the evolution of computer language is toward later and later binding and evaluation. So while one might quibble about the virtues of Java or the CLI (also known as microsoft.net) it seems inevitable that more and more software will be written for or at least compiled to virtual machines. While this trend has many virtues, not the least of which is compatibility, current implementations have several drawbacks. However, by cleverly incorporating these features into the OS, or at least including support for them, we can overcome these limitations and in some cases even turn them into strengths.
Permalink for comment
To read all comments associated with this story, please click here.
JIT is faster than static compilation
by Slava on Mon 10th Jan 2005 23:34 UTC

Theretically a VM can achieve higher performance than static compilation. A VM can use runtime type feedback -- that is, it can look at what parameter types functions are being called with, and compile specialized versions of those functions for those parameter types, thus avoiding runtime type dispatch. A static compiler can also compile specialized versions of functions, but it does not have the luxury of runtime type feedback, so it doesn't really know how many of what specializers to compile. Before you say that this only applies to dynamically-typed languages, even some langauges that we think of being statically-typed, such as C++ and Java, have runtime type dispatch, for example in the implementation of virtual methods, and thus they can benefit from runtime type feedback.

Sun's implementation of Java does this, but Java has a reputation of being slow so it is not a good example. Other languages that use this technique include Self and VisualWorks Smalltalk.