Copy-and-Patch Just-in-Time Compiler for R
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.
Authors
- Filip Křikava (ORCID: https://orcid.org/0000-0002-0478-6202)
- Jan Vítek (ORCID: https://orcid.org/0000-0003-4052-3458)
- Matěj Kocourek
Institutions
- Northeastern University (US)
- Charles University (CZ)
- Czech Technical University in Prague (CZ)
Publication Details
- Published
- 2025-10-09
- DOI
- https://doi.org/10.1145/3759548.3763370
- Primary Topic
- Scientific Computing and Data Management
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- National Science Foundation
- Grantová Agentura České Republiky