Abstract
The R language, from the point of view of language design and implementation, is a unique combination of various programming language concepts. It has functional characteristics like lazy evaluation of arguments, but also allows expressions to have arbitrary side effects. Many runtime data structures, for example variable scopes and functions, are accessible and can be modified while a program executes. Several different object models allow for structured programming, but the object models can interact in surprising ways with each other and with the base operations of R.
R works well in practice, but it is complex, and it is a challenge for language developers trying to improve on the current state-of-the-art, which is the reference implementation -- GNU R. The goal of this work is to demonstrate that, given the right approach and the right set of tools, it is possible to create an implementation of the R language that provides significantly better performance while keeping compatibility with the original implementation.
In this paper we describe novel optimizations backed up by aggressive speculation techniques and implemented within FastR, an alternative R language implementation, utilizing Truffle -- a JVM-based language development framework developed at Oracle Labs. We also provide experimental evidence demonstrating effectiveness of these optimizations in comparison with GNU R, as well as Renjin and TERR implementations of the R language.
- D. Ancona, M. Ancona, A. Cuni, and N. D. Matsakis. Rpython: A step towards reconciling dynamically and statically typed oo languages. In DLS 2007, 2007. Google Scholar
Digital Library
- R. A. Becker, J. M. Chambers, and A. R. Wilks. The new S language: a programming environment for data analysis and graphics. Chapman and Hall/CRC, 1988. Google Scholar
Digital Library
- BeDataDriven. Renjin, 2016.Google Scholar
- R. Ennals and S. P. Jones. Optimistic evaluation: an adaptive evaluation strategy for non-strict programs. In ICFP 2003, 2003. Google Scholar
Digital Library
- K.-F. Faxén. Cheap eagerness: Speculative evaluation in a lazy functional language. In ICFP 2000, 2000.Google Scholar
- B. Fulgham and D. Bagley. The computer language benchmarks game, 2013.Google Scholar
- Y. Futamura. Partial evaluation of computation process—anapproach to a compiler-compiler. Higher Order Symbol. Comput., 12(4), 1999. Google Scholar
Digital Library
- Google. Google’s r style guide.Google Scholar
- R. Ihaka and R. Gentleman. R: A language for data analysis and graphics. Journal of Computational and Graphical Statistics, 5(3), 1996.Google Scholar
- JRuby. JRuby: The Ruby programming language on the JVM, 2016.Google Scholar
- T. Kalibera, P. Maj, F. Morandat, and J. Vitek. A fast abstract syntax tree interpreter for r. In VEE 2015, 2015. Google Scholar
Digital Library
- C. Lattner and V. Adve. Llvm: A compilation framework for lifelong program analysis & transformation. In CGO 2004, 2004. Google Scholar
Digital Library
- J.-W. Maessen. Eager Haskell: resource-bounded execution yields efficient iteration. In ICFP 2002, 2002.Google Scholar
- S. Marr and S. Ducasse. Tracing vs. partial evaluation: Comparing meta-compilation approaches for self-optimizing interpreters. In OOPSLA 2015, 2015. Google Scholar
Digital Library
- K. Millar. rho, 2016.Google Scholar
- R. Neal. pqr, 2015.Google Scholar
- Purdue. purdue-fastr, 2015.Google Scholar
- Revolution Analytics. Revolution Analytics: a 5-minute history. In UseR!, 2014.Google Scholar
- A. Runnalls. CXXR, 2008.Google Scholar
- L. Stadler, T. Würthinger, and H. Mössenböck. Partial escape analysis and scalar replacement for java. In CGO ’14, 2014. Google Scholar
Digital Library
- J. Talbot, Z. DeVito, and P. Hanrahan. Riposte: A trace-driven compiler and parallel vm for vector code in r. In PACT 2012, 2012. Google Scholar
Digital Library
- TIBCO. TERR, 2016.Google Scholar
- R. Tsegelskyi and J. Vitek. Testr: generating unit tests for r internals. In UseR!, 2014.Google Scholar
- S. Urbanek. R benchmark 2.5, 2008.Google Scholar
- P. Wadler and R. J. M. Hughes. Projections for strictness analysis. In Proceedings of the Functional Programming Languages and Computer Architecture, 1987. Google Scholar
Digital Library
- C. Wimmer and S. Brunthaler. Zippy on truffle: A fast and simple implementation of python. In SPLASH Demo 2013, 2013. Google Scholar
Digital Library
- T. 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 SPLASH Onward! 2013, 2013. Google Scholar
Digital Library
Index Terms
Optimizing R language execution via aggressive speculation
Recommendations
Optimizing R language execution via aggressive speculation
DLS 2016: Proceedings of the 12th Symposium on Dynamic LanguagesThe R language, from the point of view of language design and implementation, is a unique combination of various programming language concepts. It has functional characteristics like lazy evaluation of arguments, but also allows expressions to have ...
An efficient native function interface for Java
PPPJ '13: Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and ToolsWe present an efficient and dynamic approach for calling native functions from within Java. Traditionally, programmers use the Java Native Interface (JNI) to call such functions. This paper introduces a new mechanism which we tailored specifically ...
Truffle: a self-optimizing runtime system
SPLASH '12: Proceedings of the 3rd annual conference on Systems, programming, and applications: software for humanityWe present Truffle, a novel framework for implementing managed languages in Java™. The language implementer writes an AST interpreter, which is integrated in our framework that allows tree rewriting during AST interpretation. Tree rewrites incorporate ...







Comments