Loading…
useR!2017 has ended
Friday, July 7 • 11:36am - 11:54am
Taking Advantage of the Byte Code Compiler

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Keywords: Compiler, Byte-Code, Interpreter, Performance
Webpages: http://www.stat.uiowa.edu/~luke/R/compiler/compiler.pdf
Since version 2.13, R includes a byte-code compiler and interpreter which complement the older abstract-syntax-tree (AST) interpreter. The AST interpreter directly executes R code represented as a tree of objects produced by the parser. The byte-code compiler compiles the AST into a sequence of byte-code instructions, which is then interpreted using a byte-code interpreter. The byte-code compiler and interpreter implement a number of performance optimizations which speed up scalar code and particularly loops operating on scalar variables. Performance of highly vectorized code is likely to be unaffected by the byte-code compiler/interpreter as in fact such code spends most of the time executing outside the R interpreters. The compiler can compile packages at installation time and individual R functions on request. It can also transparently compile loops and functions as they execute (just-in-time).
The talk will show examples of code that runs particularly fast with the compiler, code that is unaffected by it, and code that runs particularly slow. The slowdowns are almost always due to time spent in compilation; once compiled and loaded, the code should not run slower than in the unoptimized AST interpreter. When triggered just-in-time, the compiler includes heuristics that try to prevent compilation in case it is not likely to pay off, but sometimes they are wrong. The talk will show on concrete examples how these overheads can be avoided. The talk will be technical and will be aimed at package authors and R users who write performance critical R code.

Speakers

Friday July 7, 2017 11:36am - 11:54am CEST
4.02 Wild Gallery