The Runabout Optimizer
While the Runabout is reasonably
fast for most settings, extensive
use in the innermost loop of applications can in extreme cases
cost up to 40% performance. An example for such an application is
a search over a Graph using visitAppropriate to traverse
over the nodes. If the per-node operations are extremely cheap,
say an identity-test, benchmarks have shown a performance loss of
up to 40% (overall) compared to an ordinary visitor.
Another possible problem with the Runabout are settings where the
use of reflection and dynamic loading are not permitted by the
runtime environment (or at least lead to heavy performance
penalties, such as interpretation instead of ahead-of-time
compilation). The Runabout Optimizer (short RO)
is an attempt to address this issue.
First, please note that the RO should only be used if performance
is really an issue, and it is highly advised to do some profiling
since some applications may see hardly any improvement or even
slight slow-downs. Using the Runabout Optimizer destroys part of
the appeal of the Runabout which is that it is very lightweight
with respect to integrating it into existing applications since it
does not require a different compiler or VM. Also note that the
RO is currently still only beta quality. The code that
is generated is suboptimal and can in some cases even be a bit
slower than the original Runabout (presumably the cost of
INVOKEINTERFACE is the primary culprit at this point, but further
performance studies are still necessary).
The RO works only with Runabout version 2.x.
It does not work with the 5.x version.
In order to use it, run
$java -jar ro.jar -dump=OUTPUT-DIRECTORY -library=rt.jar app.jar
where ro.jar is a file from the 2.x Runabout
distribution, rt.jar contains the JDK classes and
app.jar contains the application using the Runabout (and
should include the files from runabout.jar). The
rewritten classes will be dumped to the specified
OUTPUT-DIRECTORY.
Requirements for using the Runabout Optimizer
The RO will not work with applications that use the Runabout APIs
addExternalVisit, getAppropriateCode or override
getAppropriateCode. The RO (almost) requires
whole-world compilation, more specifically, all
subclasses of Runabout and all subclasses of all visitees of all
Runabouts must be available. Naturally, also all parent classes
of these classes are required. Finally, the RO works by adding
additional accept and visit methods, as well as
instanceof test sequences in various places, so expect
your code to grow in size (especially with the current preliminary
version that may sometimes generate more code than strictly
necessary).
The Runabout Optimizer only works with Runabout of version 2.x.
The runtime of the RO is about 60s for 60.000 lines of code on a
P4 with 2.4GHz. Speedups are in the range of up to 50%, but most
applications will see much less if any changes (which is why the
optimizer only makes sense if you are using the Runabout in a
critical section of the application).
Download
The RO is unsupported software. You can find it
in an older release of the XTC source tree
here.
Contact
The Runabout Optimizer was written by
Christian Grothoff.
christian@grothoff.org