5 questions to test your understanding
A tree-walking interpreter executes a loop body 100,000 times. Why is this significantly slower than a bytecode interpreter running the same loop, even though both compute the same result?
A language designer needs to choose an execution model for a new scripting language. Performance matters but the team has limited resources, and the language must run portably across many platforms. Which execution model is the best fit?
A JIT compiler introduces warmup time because the program initially runs in interpreted mode while the JIT identifies which code paths are hot enough to compile.
Bytecode interpreters are slower than tree-walking interpreters because they require an additional compilation step (AST → bytecode) before execution can begin.
Explain why bytecode interpretation is faster than tree-walking interpretation, despite requiring an additional compilation step before execution begins.