How to make best use of the byte compiler in R

August 7, 2017
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Tomas Kalibera,  the newest member of the R Core Team, has been working for the last several years with fellow Core Team member Luke Tierney implementing R's byte-code compiler and interpreter. Byte-compiling R code often improves its speed of execution, and usually happens without you having to take any explicit action. R's base and recommended packages are compiled when R is installed, and your scripts and functions are automatically compiled "just-in-time" as you execute them. 

At the useR!2017 conference last month, Tomas Kalibera gave a very interesting talk: Taking Advantage of the Byte Compiler. In particular, he shows that not all R code is equivalent to the byte compiler. For example, the byte compiler has most impact on code that works with scalar arithmetic in tight loops. There's also some kinds of R code that takes a relatively long time to compile, which can swamp the performance benefits if the function is compiled at execution-time. (Package authors can avoid this for their users by declaring that their packages be compiled on install, by including Byte-Compile: yes in the DESCRIPTION file.) For package authors and R users that care about performance, you can find lots of tips like this in the talk embedded below.

For even more details on the implementation of the byte-compiler, take a look at the document A Byte Compiler for R by Luke Tierney.

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)