skip to main content
article

Optimizing R language execution via aggressive speculation

Published:01 November 2016Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. BeDataDriven. Renjin, 2016.Google ScholarGoogle Scholar
  4. R. Ennals and S. P. Jones. Optimistic evaluation: an adaptive evaluation strategy for non-strict programs. In ICFP 2003, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. K.-F. Faxén. Cheap eagerness: Speculative evaluation in a lazy functional language. In ICFP 2000, 2000.Google ScholarGoogle Scholar
  6. B. Fulgham and D. Bagley. The computer language benchmarks game, 2013.Google ScholarGoogle Scholar
  7. Y. Futamura. Partial evaluation of computation process—anapproach to a compiler-compiler. Higher Order Symbol. Comput., 12(4), 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Google. Google’s r style guide.Google ScholarGoogle Scholar
  9. R. Ihaka and R. Gentleman. R: A language for data analysis and graphics. Journal of Computational and Graphical Statistics, 5(3), 1996.Google ScholarGoogle Scholar
  10. JRuby. JRuby: The Ruby programming language on the JVM, 2016.Google ScholarGoogle Scholar
  11. T. Kalibera, P. Maj, F. Morandat, and J. Vitek. A fast abstract syntax tree interpreter for r. In VEE 2015, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. C. Lattner and V. Adve. Llvm: A compilation framework for lifelong program analysis & transformation. In CGO 2004, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J.-W. Maessen. Eager Haskell: resource-bounded execution yields efficient iteration. In ICFP 2002, 2002.Google ScholarGoogle Scholar
  14. S. Marr and S. Ducasse. Tracing vs. partial evaluation: Comparing meta-compilation approaches for self-optimizing interpreters. In OOPSLA 2015, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. K. Millar. rho, 2016.Google ScholarGoogle Scholar
  16. R. Neal. pqr, 2015.Google ScholarGoogle Scholar
  17. Purdue. purdue-fastr, 2015.Google ScholarGoogle Scholar
  18. Revolution Analytics. Revolution Analytics: a 5-minute history. In UseR!, 2014.Google ScholarGoogle Scholar
  19. A. Runnalls. CXXR, 2008.Google ScholarGoogle Scholar
  20. L. Stadler, T. Würthinger, and H. Mössenböck. Partial escape analysis and scalar replacement for java. In CGO ’14, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. TIBCO. TERR, 2016.Google ScholarGoogle Scholar
  23. R. Tsegelskyi and J. Vitek. Testr: generating unit tests for r internals. In UseR!, 2014.Google ScholarGoogle Scholar
  24. S. Urbanek. R benchmark 2.5, 2008.Google ScholarGoogle Scholar
  25. P. Wadler and R. J. M. Hughes. Projections for strictness analysis. In Proceedings of the Functional Programming Languages and Computer Architecture, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. C. Wimmer and S. Brunthaler. Zippy on truffle: A fast and simple implementation of python. In SPLASH Demo 2013, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Optimizing R language execution via aggressive speculation

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 52, Issue 2
      DLS '16
      February 2017
      131 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/3093334
      Issue’s Table of Contents
      • cover image ACM Conferences
        DLS 2016: Proceedings of the 12th Symposium on Dynamic Languages
        November 2016
        131 pages
        ISBN:9781450344456
        DOI:10.1145/2989225

      Copyright © 2016 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 November 2016

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!