Exploring Virtual Machines for Embedded Languages
During my tenure at Google, I had the opportunity to work with several talented interns. One of them, Maria Chizhova, undertook an impressive research project for her master’s thesis titled “Investigation of Virtual Machines for Embedded Languages in Go.” In her study, Maria compared different types of virtual machines tailored for embedded languages, a task crucial for ensuring high performance in various applications.
Embedded languages, which are specialized languages written within another language, often require efficient virtual machines to optimize performance. Maria’s research, conducted within the innovative environment at Google, involved implementing and benchmarking five distinct types of virtual machines: a tree-traversal VM, three variations of stack-based VMs, and a register-based VM.
One notable aspect of her research was the use of Google Cloud Platform (GCP) for performance monitoring and analysis. Leveraging GCP’s robust infrastructure provided detailed insights into the performance characteristics of each virtual machine type under different scenarios, ensuring accurate and comprehensive results.
For those interested in a deep dive into her findings, we have made Maria Chizhova’s complete thesis available for download here.
Benchmark Performance of Various Virtual Machines
Below is a graph illustrating the performance of various virtual machines based on different benchmarks such as Sum from 1 to 200, Alternating Sum from 1 to 200, String Concatenation, String Comparison & Logic Operations, and Sum of External Variables.
The graph shows the execution time (in nanoseconds) for each benchmark across different types of virtual machines:
- Tree Traversal VM
- Single Stack VM
- Multiple Stack VM
- Reflective VM
- Register-based VM
Each benchmark provides a comparative view of how each VM type performs under specific conditions.
For instance, the Tree Traversal VM shows higher execution times across most benchmarks, indicating it is less efficient compared to other VM types. On the other hand, the Register-based VM consistently shows the lowest execution times, suggesting it is the most efficient among the evaluated VMs.
This visual comparison highlights the strengths and weaknesses of each VM type, helping developers choose the most suitable VM for their specific embedded language requirements.
Impact on the Development of the Expr Language
Maria’s research has had a significant impact on our work on the Expr language. By thoroughly evaluating the performance of different virtual machines, we were able to identify the most efficient approaches for implementing the core of Expr. Specifically, the insights gained from the performance of stack-based and register-based VMs guided us in optimizing our execution engine, resulting in faster and more reliable expression evaluation.
Moreover, the use of GCP for performance monitoring and analysis has influenced our ongoing development practices, ensuring that Expr remains not only powerful but also highly efficient. As a result, users of the Expr language can expect improved performance in real-world applications, particularly in scenarios requiring high throughput and low latency.