[Rd] Compiling R scripts

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Mon Jul 4 16:22:04 CEST 2005


Uzuner, Tolga wrote:
> Dear R Developers,

> It would help if R scripts could be compiled into an executable, or a
> library.

  Are you sure it would help? If you do a big matrix operation in R it 
runs at the speed of the underlying C code. It wont get much faster. 
Profile your code, find out where the time is being spent, then optimise 
_that_.

> Speed is the main issue (I run a large scale monte carlo in
> R which is very slow).

  The reason its very slow is not because its 'in R' but because it is a 
'large scale monte carlo'. What was a 'large scale' monte-carlo ten 
years ago runs in no time today. 'large scale' == 'slow' almost by 
definition.

  Unless you've done comparisons with the same code written in some 
other language.

> However, it would also make it easier to link
> R into other applications, easier at least than the COM
> infrastructure under Windows.

  R can be called from C, and there are application links to Python, 
Perl, Java... Easy enough.

> Finally, it would make it much easier to farm R apps: rather than
> distributing all of R and necessary libraries onto each client, and
> making sure each client is always up to date as libraries for a
> specific script change, it might be easier just to distribute a
> simple executable across all nodes.

  Keeping a bunch of clients up to date is as easy as a quick scripted 
rsync command, or completely transparent if you have a shared /usr/local 
filesystem (Unix).

  There is some work going on to produce an R compiler, but I dont think 
these are the reasons.

Baz



More information about the R-devel mailing list