This page is no longer maintained — Please continue to the home page at

Why field variables are much slower then local variables in JIT compilers?

No replies
Joined: 2009-10-06,
User offline. Last seen 2 years 39 weeks ago.

Hi all,

from my experience with ScalaLab, I observed that when I wrap
computational code within a method of a synthetic Scala object it is
executed much faster (i.e. 10 to 60 times faster) than when the same
code runs as a Scala script.

This obviously has its reason with the implementation of variables in
script with field variables in Scala Interpreter code.
It is of course necessary in order to keep the binding of the variables
to their values in the synthetically created interpreter "global"
but can somebody explain why so much speed difference in favor of local


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland