AST vs Bytecode: Interpreters in the Age of Meta-compilation (stefan-marr.de)
from TheCee@programming.dev to programming_languages@programming.dev on 14 Aug 2023 21:23
https://programming.dev/post/1723974

#programming_languages

threaded - newest

armchair_progamer@programming.dev on 15 Aug 2023 05:05 collapse

The important parts IMO (emphasis mine):

Our results show that both systems indeed reach performance close to Node.js/V8. Looking at interpreter- only performance, our AST interpreters are on par with, or even slightly faster than their bytecode counterparts. After just-in-time compilation, the results are roughly on par. This means bytecode interpreters do not have their widely assumed performance advantage. However, we can confirm that bytecodes are more compact in memory than ASTs, which becomes relevant for larger applications. However, for smaller applications, we noticed that bytecode interpreters allocate more memory because boxing avoidance is not as applicable, and because the bytecode interpreter structure requires memory, e.g., for a reified stack.

Our results show AST interpreters to be competitive on top of meta-compilation systems. Together with possible engineering benefits, they should thus not be discounted so easily in favor of bytecode interpreters.