Proceedings paper

Title:
Copy-and-Patch Just-in-Time Compiler for R
Authors:
M. Kocourek, F. Křikava, J. Vitek
Publication:
Proceedings of the 17th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages
DOI:
Year:
2025
ISBN:
9798400721649
Link:

Abstract:
Copy-and-patch is a technique for building baseline just-in-time compilers from existing interpreters. It has been successfully applied to languages such as Lua and Python. This paper reports on our experience using this technique to implement a compiler for the R programming language. We describe how this new compiler integrates with the GNU R virtual machine, present the key optimizations we implemented, and evaluate the feasibility of this approach for R. Copy-and-patch also allows extensions such as integration of the feedback recording required by multi-tier compilation. Our evaluation on 57 programs demonstrates very fast compilation times (980 bytecode instructions per millisecond), reasonable performance gains (1.15x–1.91x speedup over GNU R), and manageable implementation complexity.

BibTeX:
@inproceedings{kocourek_copyandpatch_2025,
    title = {{Copy-and-Patch Just-in-Time Compiler for R}},
    author = {Kocourek, Matěj and Křikava, Filip and Vitek, Jan},
    year = {2025},
    booktitle = {{Proceedings of the 17th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages}},
    publisher = {Association for Computing Machinery},
    series = {{VMIL '25}},
    location = {New York, NY, USA},
    doi = {10.1145/3759548.3763370},
    isbn = {9798400721649},
    pages = {12--21},
    url = {https://doi.org/10.1145/3759548.3763370},
}