skip to main content
10.1145/2576195.2576205acmconferencesArticle/Chapter ViewAbstractPublication PagesveeConference Proceedingsconference-collections
research-article

A fast abstract syntax tree interpreter for R

Published: 01 March 2014 Publication History

Abstract

Dynamic languages have been gaining popularity to the point that their performance is starting to matter. The effort required to develop a production-quality, high-performance runtime is, however, staggering and the expertise required to do so is often out of reach of the community maintaining a particular language. Many domain specific languages remain stuck with naive implementations, as they are easy to write and simple to maintain for domain scientists. In this paper, we try to see how far one can push a naive implementation while remaining portable and not requiring expertise in compilers and runtime systems. We choose the R language, a dynamic language used in statistics, as the target of our experiment and adopt the simplest possible implementation strategy, one based on evaluation of abstract syntax trees. We build our interpreter on top of a Java virtual machine and use only facilities available to all Java programmers. We compare our results to other implementations of R.

References

[1]
P. S. Abrams. An APL machine. Ph.D. thesis, Stanford University, 1970.
[2]
R. A. Becker, J. M. Chambers, and A. R. Wilks. The new S language: a programming environment for data analysis and graphics. Wadsworth and Brooks/Cole Advanced Books & Software, 1988.
[3]
C. Chambers and D. Ungar. Making pure object oriented languages practical. In Proceedings of Object-Oriented Programming Systems, Languages and Applications (OOPSLA), 1991.
[4]
S. Chirokoff, C. Consel, and R. Marlet. Combining program and data specialization. Higher-Order and Symbolic Computation, 12 (4), 1999.
[5]
D. Eddelbuettel and C. Sanderson. RcppArmadillo: accelerating R with high-performance C++ linear algebra. Computational Statistics & Data Analysis, 71, 2014.
[6]
B. Fulgham and D. Bagley. The computer language benchmarks game. http://benchmarksgame.alioth.debian.org, 2013.
[7]
A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of Programming Language Design and Implementation (PLDI), 2009. http://doi.acm.org/10.1145/1542476.1542528.
[8]
R. Ihaka and R. Gentleman. R: A language for data analysis and graphics. Journal of Computational and Graphical Statistics, 5 (3), 1996.
[9]
D. McNamee, J. Walpole, C. Pu, C. Cowan, C. Krasic, A. Goel, P. Wagle, C. Consel, G. Muller, and R. Marlet. Specialization tools and techniques for systematic optimization of system software. ACM Transactions on Computer Systems, 19 (2), 2001.
[10]
F. Morandat, B. Hill, L. Osvald, and J. Vitek. Evaluating the design of the R language. In Proceedings of European Conference on Object-Oriented Programming (ECOOP), 2012.
[11]
L. Osvald. R shootout. http://r.cs.purdue.edu/hg/r-shootout, 2012.
[12]
R Development Core Team. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, 2008. http://www.r-project.org.
[13]
D. Smith. The R ecosystem. In R User Conference (UseR), 2011.
[14]
J. Talbot, Z. DeVito, and P. Hanrahan. Riposte: a trace-driven compiler and parallel VM for vector code in R. In Proceedings of Parallel Architectures and Compilation Techniques (PACT), 2012.
[15]
L. Tierney. A Byte Code Compiler for R. University of Iowa, 2012. http://homepage.stat.uiowa.edu/ luke/R/compiler/compiler.pdf.
[16]
S. Urbanek. R benchmark 2.5. http://r.research.att.com/benchmarks, 2008.
[17]
Würthinger, Wimmer, Wöß, Stadler, Duboscq, Humer, Richards, Simon, and Wolczko}Truf13T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to rule them all. In Proceedings of Onward!, the ACM Symposium on New Ideas in Programming and Reflections on Software, 2013.

Cited By

View all
  • (2025)Copy-and-Patch Just-in-Time Compiler for RProceedings of the 17th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3759548.3763370(12-21)Online publication date: 9-Oct-2025
  • (2023)Reusing Just-in-Time Compiled CodeProceedings of the ACM on Programming Languages10.1145/36228397:OOPSLA2(1176-1197)Online publication date: 16-Oct-2023
  • (2023)AST vs. Bytecode: Interpreters in the Age of Meta-CompilationProceedings of the ACM on Programming Languages10.1145/36228087:OOPSLA2(318-346)Online publication date: 16-Oct-2023
  • Show More Cited By

Recommendations

Comments