Interpreter Performance & Optimizations
Resources
Attention: next week will be a hands on lab. Please bring your laptops.
Quiz
The upstream/student repository now contains quiz #2. If necessary, merge the contents of the upstream repository into your personal repository and commit and push the quiz answers to your personal repository by Tuesday, March 14 2023, 14:00.
Bonus coding task
The bonus coding task from this lecture is to optimize the baseline implementation of the JaraScript interpreter so that the JaraBench benchmark shows a significant improvement over the baseline solution.
The goal is not to rewrite the entire interpreter, but to find performance left on the table in the straightforward solution. Specifically:
-
You must preserve the AST structure of the interpreter, i.e., Java objects representing AST nodes and execution implemented as recursive calls of node methods. However, you can modify the existing nodes, add new nodes, etc.
-
You can do whatever you need when constructing the
ExecutionRoot
object in theJaraScriptLanguage.createExecutionRoot()
method. This method is executed once before executing the benchmark and its duration is not part of the measured execution. However, you cannot pre-compute the result of the program in that method. -
Your optimizations should be general and ± applicable to other (similar, but not the same) benchmarks.
The above rules are intentionally vague and incomplete. Please use common sense in judging what is and is not beyond the point of this exercise. Trying to write down exact rules would be an exercise in futility.
Bonus points awarded:
- speedup >= 1.75x over straightforward solution (5 points)
- best performance in class (5 points)
The deadline for completing the bonus task is also Tuesday, March 14 2023, 14:00.