[Rd] Pre-compilation and server-side parallel execution

Erik van Zijst r at erik.prutser.cx
Sat Dec 9 14:35:19 CET 2006

Simon Urbanek wrote:
> On Dec 8, 2006, at 9:51 AM, Erik van Zijst wrote:
>> 2. R's native C-api
>> [http://cran.r-project.org/doc/manuals/R-exts.html#The-R-API] does not 
>> separate parsing from evaluation.

N.B. above I mistakenly referred to chapter "The R API", but instead I 
was referring to what I read in "Linking GUIs and other front-ends to R".

> Actually it does - see "R_ParseVector" and "eval". You're free to run 
> the parser once (or even construct the expression directly) and evaluate 
> it many times. (Also note that you can serialize the parsed expression 
> if desired).

I think I saw that code fragment, but was under the impression that it 
illustrated how to interact with the R runtime from within a C function 
that is invoked from R (R -> C -> R), rather than directly from C. I'll 
certainly explore this further, thanks for pointing this out.

> If your worries are really at this level, then you will have to create 
> entirely your own solution, because the overhead of IPC will be way more 
> that the time spent in the parser. Actually I'm wondering whether you 
> checked it at all, because I'd almost certainly expect the evaluation to 
> take way more time than the parsing step. If it does, I'd be inclined to 
> think that you have rather a design problem.

Your suspicion is correct Simon, I'm afraid I have not tested anything 
yet, so I'm not sure my worries are justified at all. I'm also entirely 
new to R and I'm not a statistician. I'm involved in this project as a 
systems architect and responsible for choosing a dynamic, programmable 
evaluation environment. Since it'll be all about financial data analysis 
(with analysts currently using matlab and stata on the desktop) I 
studied the area and R surfaced as the most interesting candidate. But 
as you suggest, before we embark on actual development, I need to verify 
that integration of R is feasible in this design. I apologize if this 
yields somewhat elementary questions.

What is your opinion on parallel evaluation of expressions? Is that 
possible in a single R engine instance, or would I need to create a pool 
of instances with IPC like R/Apache does?

	"I ain't broke, but I'm badly bent."

More information about the R-devel mailing list