1 Department of Computer Science, Science and Technology, Aarhus University2 Tufts University3 Veracode4 Department of Computer Science, Science and Technology, Aarhus University
A definitional interpreter should be clear and easy to write, but it may run 4--10 times slower than a well-crafted bytecode interpreter. In a case study focused on implementation choices, we explore ways of making definitional interpreters faster without expending much programming effort. We implement, in OCaml, interpreters based on three semantics for a simple subset of Lua. We compile the OCaml to x86 native code, and we systematically investigate hundreds of combinations of algorithms and data structures. In this experimental context, our fastest interpreters are based on natural semantics; good algorithms and data structures make them 2--3 times faster than naïve interpreters. Our best interpreter, created using only modest effort, runs only 1.5 times slower than a mature bytecode interpreter implemented in C.
Proceedings of the 15th Symposium on Principles and Practice of Declarative Programming , Ppdp '13, 2013, p. 121-132
Main Research Area:
Symposium on Principles and Practice of Declarative Programming, 2013