Many guest languages are implemented using the Java Virtual Machine (JVM) as a host environment. There are two major implementation choices: custom compilers and so-called hosted interpreters. Custom compilers are complex to build but offer good performance. Hosted interpreters are comparatively simpler to implement but until now have suffered from poor performance. We studied the performance of hosted interpreters and identified common bottlenecks preventing their efficient execution. First, similar to interpreters written in C/C++, instruction dispatch is expensive on the JVM. Second, Java’s semantics require expensive runtime exception checks that negatively affect array performance essential to interpreters. We present two optimizations targeting these bottlenecks and show that the performance of optimized interpreters increases dramatically: we report speedups by a factor of up to 2.45 over the Jython interpreter, 3.57 over the Rhino interpreter, and 2.52 over the JRuby interpreter, respectively. The resulting performance is comparable with that of custom compilers. Our optimizations are enabled by a few simple annotations that require only modest implementation effort; in return, performance increases substantially.
%0 Journal Article
%1 Savrun-Yeniceri:2014:EHI
%A Savrun-Yeniceri, Gülfem
%A Zhang, Wei
%A Zhang, Huahan
%A Seckler, Eric
%A Li, Chen
%A Brunthaler, Stefan
%A Larsen, Per
%A Franz, Michael
%C New York, NY, USA
%D 2014
%I ACM
%J ACM Trans. Archit. Code Optim.
%K Interpreter JRuby JVM Optimization Python SuperInstructions ThreadedCode
%N 1
%P 9:1--9:24
%R 10.1145/2532642
%T Efficient Hosted Interpreters on the JVM
%V 11
%X Many guest languages are implemented using the Java Virtual Machine (JVM) as a host environment. There are two major implementation choices: custom compilers and so-called hosted interpreters. Custom compilers are complex to build but offer good performance. Hosted interpreters are comparatively simpler to implement but until now have suffered from poor performance. We studied the performance of hosted interpreters and identified common bottlenecks preventing their efficient execution. First, similar to interpreters written in C/C++, instruction dispatch is expensive on the JVM. Second, Java’s semantics require expensive runtime exception checks that negatively affect array performance essential to interpreters. We present two optimizations targeting these bottlenecks and show that the performance of optimized interpreters increases dramatically: we report speedups by a factor of up to 2.45 over the Jython interpreter, 3.57 over the Rhino interpreter, and 2.52 over the JRuby interpreter, respectively. The resulting performance is comparable with that of custom compilers. Our optimizations are enabled by a few simple annotations that require only modest implementation effort; in return, performance increases substantially.
@article{Savrun-Yeniceri:2014:EHI,
abstract = {Many guest languages are implemented using the Java Virtual Machine (JVM) as a host environment. There are two major implementation choices: custom compilers and so-called hosted interpreters. Custom compilers are complex to build but offer good performance. Hosted interpreters are comparatively simpler to implement but until now have suffered from poor performance. We studied the performance of hosted interpreters and identified common bottlenecks preventing their efficient execution. First, similar to interpreters written in C/C++, instruction dispatch is expensive on the JVM. Second, Java’s semantics require expensive runtime exception checks that negatively affect array performance essential to interpreters. We present two optimizations targeting these bottlenecks and show that the performance of optimized interpreters increases dramatically: we report speedups by a factor of up to 2.45 over the Jython interpreter, 3.57 over the Rhino interpreter, and 2.52 over the JRuby interpreter, respectively. The resulting performance is comparable with that of custom compilers. Our optimizations are enabled by a few simple annotations that require only modest implementation effort; in return, performance increases substantially.},
acmid = {2532642},
added-at = {2014-08-20T08:47:45.000+0200},
address = {New York, NY, USA},
articleno = {9},
author = {Savrun-Yeni\c{c}eri, G\"{u}lfem and Zhang, Wei and Zhang, Huahan and Seckler, Eric and Li, Chen and Brunthaler, Stefan and Larsen, Per and Franz, Michael},
biburl = {https://www.bibsonomy.org/bibtex/2e002db9998b79efe8df2c24f771e638a/gron},
description = {Efficient hosted interpreters on the JVM},
doi = {10.1145/2532642},
interhash = {0b2c237ad314479fcd07afb37768a5ce},
intrahash = {e002db9998b79efe8df2c24f771e638a},
issn = {1544-3566},
issue_date = {February 2014},
journal = {ACM Trans. Archit. Code Optim.},
keywords = {Interpreter JRuby JVM Optimization Python SuperInstructions ThreadedCode},
month = {February},
number = 1,
numpages = {24},
pages = {9:1--9:24},
publisher = {ACM},
timestamp = {2014-08-20T08:47:45.000+0200},
title = {Efficient Hosted Interpreters on the JVM},
volume = 11,
year = 2014
}