Interpreter performance remains important today. Interpreters are needed in
resource constrained systems, and even in systems with just-in-time compilers,
they are crucial during warm up. A common form of interpreters is a bytecode
interpreter, where the interpreter executes bytecode instructions one by one.
Each bytecode is executed by the corresponding bytecode handler.
In this paper, we show that the order of the bytecode handlers in the
interpreter source code affects the execution performance of programs on the
interpreter. On the basis of this observation, we propose a genetic algorithm
(GA) approach to find an approximately optimal order. In our GA approach, we
find an order optimized for a specific benchmark program and a specific CPU.
We evaluated the effectiveness of our approach on various models of CPUs
including x86 processors and an ARM processor. The order found using GA
improved the execution speed of the program for which the order was optimized
between 0.8% and 23.0% with 7.7% on average. We also assess the cross-benchmark
and cross-machine performance of the GA-found order. Some orders showed good
generalizability across benchmarks, speeding up all benchmark programs.
However, the solutions do not generalize across different machines, indicating
that they are highly specific to a microarchitecture.
%0 Conference Paper
%1 Huang:2023:GA
%A Huang, Wanhong
%A Marr, Stefan
%A Ugawa, Tomoharu
%B The 38th ACM/SIGAPP Symposium on Applied Computing (SAC '23)
%D 2023
%I ACM
%K Bytecodes CodeLayout EmbeddedSystems GeneticAlgorithm Interpreter JavaScript MeMyPublication Optimization myown
%P 10
%R 10.1145/3555776.3577712
%T Optimizing the Order of Bytecode Handlers in Interpreters using a Genetic Algorithm
%X Interpreter performance remains important today. Interpreters are needed in
resource constrained systems, and even in systems with just-in-time compilers,
they are crucial during warm up. A common form of interpreters is a bytecode
interpreter, where the interpreter executes bytecode instructions one by one.
Each bytecode is executed by the corresponding bytecode handler.
In this paper, we show that the order of the bytecode handlers in the
interpreter source code affects the execution performance of programs on the
interpreter. On the basis of this observation, we propose a genetic algorithm
(GA) approach to find an approximately optimal order. In our GA approach, we
find an order optimized for a specific benchmark program and a specific CPU.
We evaluated the effectiveness of our approach on various models of CPUs
including x86 processors and an ARM processor. The order found using GA
improved the execution speed of the program for which the order was optimized
between 0.8% and 23.0% with 7.7% on average. We also assess the cross-benchmark
and cross-machine performance of the GA-found order. Some orders showed good
generalizability across benchmarks, speeding up all benchmark programs.
However, the solutions do not generalize across different machines, indicating
that they are highly specific to a microarchitecture.
%@ 978-1-4503-9517-5/23/03
@inproceedings{Huang:2023:GA,
abstract = {Interpreter performance remains important today. Interpreters are needed in
resource constrained systems, and even in systems with just-in-time compilers,
they are crucial during warm up. A common form of interpreters is a bytecode
interpreter, where the interpreter executes bytecode instructions one by one.
Each bytecode is executed by the corresponding bytecode handler.
In this paper, we show that the order of the bytecode handlers in the
interpreter source code affects the execution performance of programs on the
interpreter. On the basis of this observation, we propose a genetic algorithm
(GA) approach to find an approximately optimal order. In our GA approach, we
find an order optimized for a specific benchmark program and a specific CPU.
We evaluated the effectiveness of our approach on various models of CPUs
including x86 processors and an ARM processor. The order found using GA
improved the execution speed of the program for which the order was optimized
between 0.8% and 23.0% with 7.7% on average. We also assess the cross-benchmark
and cross-machine performance of the GA-found order. Some orders showed good
generalizability across benchmarks, speeding up all benchmark programs.
However, the solutions do not generalize across different machines, indicating
that they are highly specific to a microarchitecture.},
added-at = {2023-01-17T11:59:10.000+0100},
author = {Huang, Wanhong and Marr, Stefan and Ugawa, Tomoharu},
biburl = {https://www.bibsonomy.org/bibtex/260108f1e08227c042471011ad3b30091/gron},
blog = {https://stefan-marr.de/2023/06/squeezing-a-little-more-performance-out-of-bytecode-interpreters/},
booktitle = {The 38th ACM/SIGAPP Symposium on Applied Computing (SAC '23)},
doi = {10.1145/3555776.3577712},
interhash = {e4853aaea0b9e1a714a61d68c235ef89},
intrahash = {60108f1e08227c042471011ad3b30091},
isbn = {978-1-4503-9517-5/23/03},
keywords = {Bytecodes CodeLayout EmbeddedSystems GeneticAlgorithm Interpreter JavaScript MeMyPublication Optimization myown},
month = {March},
pages = 10,
pdf = {https://stefan-marr.de/downloads/acmsac23-huang-et-al-optimizing-the-order-of-bytecode-handlers-in-interpreters-using-a-genetic-algorithm.pdf},
publisher = {ACM},
series = {SAC'23},
timestamp = {2023-06-06T17:53:13.000+0200},
title = {{Optimizing the Order of Bytecode Handlers in Interpreters using a Genetic Algorithm}},
year = 2023
}