Re: [R] Compiling R code to native code?
Nope. Most users get speed by using vectorized calculations. If you have already identified how to get correct answers, the next step is something like Rcpp or linking to a shared library written in your language of choice. But seriously, vectorizing is enough for most applications, and making sure the answer is right doesn't usually require compiled code. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Gregory Propf gregorypr...@yahoo.com wrote: Simple question: is there a way to compile R scripts to native code? �If not is there anything else that might improve speed? �I'm not even sure that R compiles internally to byte code or not. �I assume it does since all modern languages seem to do this. �Maybe there's a JIT compiler? �Yes, I have searched Google and get lots of stuff that's seems confusing. �I just want to know what packages to install and how to use them to generate binaries if they exist. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Compiling R code to native code?
Facts: 1. R does not by default compile bytecode. It uses a read-parse-eval cycle as described in the R Language Manual. 2. However, as of 2.14.0 (anyway) there is a compiler package that is shipped as part of the standard distribution. Written by Luke Tierney and his graduate student minions, it is described here: http://www.divms.uiowa.edu/~luke/R/compiler/compiler.pdf As usual, it can result in considerable speedup, though vectorization is still a good strategy when possible. To be clear, Jeff's original reply is correct -- R is interpreted, not compiled. Cheers, Bert On Sat, Jan 28, 2012 at 5:01 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: Nope. Most users get speed by using vectorized calculations. If you have already identified how to get correct answers, the next step is something like Rcpp or linking to a shared library written in your language of choice. But seriously, vectorizing is enough for most applications, and making sure the answer is right doesn't usually require compiled code. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Gregory Propf gregorypr...@yahoo.com wrote: Simple question: is there a way to compile R scripts to native code? �If not is there anything else that might improve speed? �I'm not even sure that R compiles internally to byte code or not. �I assume it does since all modern languages seem to do this. �Maybe there's a JIT compiler? �Yes, I have searched Google and get lots of stuff that's seems confusing. �I just want to know what packages to install and how to use them to generate binaries if they exist. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Compiling R code to native code?
Jeff Newmiller jdnewmil at dcn.davis.ca.us writes: Nope. Most users get speed by using vectorized calculations. If you have already identified how to get correct answers, the next step is something like Rcpp or linking to a shared library written in your language of choice. But seriously, vectorizing is enough for most applications, and making sure the answer is right doesn't usually require compiled code. Gregory Propf gregorypropf at yahoo.com wrote: Simple question: is there a way to compile R scripts to native code? �If not is there anything else that might improve speed? �I'm not even sure that R compiles internally to byte code or not. �I assume it does since all modern languages seem to do this. �Maybe there's a JIT compiler? �Yes, I have searched Google and get lots of stuff that's seems confusing. �I just want to know what packages to install and how to use them to generate binaries if they exist. [[alternative HTML version deleted]] Note that there is a fairly recently introduced byte-compiler for R (library(compiler); ?compile). There's also http://www.milbo.users.sonic.net/ra/ , which looks a little out of date by now (last release August 2011), but it might be worht comparing. As Jeff said, though, there is usually room for lots of speed improvement via vectorizing (or using add-on packages such as data.table ). I *believe* typical speed-ups from the built-in compiler are on the order of three-fold. Porting to compiled languages (most popularly via Rcpp) can give much higher speed-ups. For more information we'd really need to know what you are trying to do. You might try searching Stack Overflow for [r] speed up ... __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.