Programming languages are never perfect, so people start building
domain-specific languages to be able to solve their problems more easily.
However, custom languages are often slow, or take enormous amounts of effort to
be made fast by building custom compilers or virtual machines.
With the notion of self-optimizing interpreters, researchers proposed a way to
implement languages easily and generate a JIT compiler from a simple
interpreter. We explore the idea and experiment with it on top of RPython (of
PyPy fame) with its meta-tracing JIT compiler, as well as Truffle, the JVM
framework of Oracle Labs for self-optimizing interpreters.
In this talk, we show how a simple interpreter can reach the same order of
magnitude of performance as the highly optimizing JVM for Java. We discuss the
implementation on top of RPython as well as on top of Java with Truffle so that
you can start right away, independent of whether you prefer the Python or JVM
ecosystem.
While our own experiments focus on SOM, a little Smalltalk variant to keep
things simple, other people have used this approach to improve peek performance
of JRuby, or build languages such as JavaScript, R, and Python 3.