Hey,
I just read another post about calling R from C. Someone on
stackoverflow (DWin makes me suspect its David W.?) referenced this:
http://www.math.univ-montp2.fr/~pudlo/R_files/call_R.pdf
Which made me think: Why is a loop in R bad, but in C not?
And where exactly does looping cost the
For the same reason the Cray XMP was fast at numerical computations... a loop
written in a low level language can be optimized to work faster than one
written in a higher level language. The XMP optimized loops into hardware, but
R just optimizes them in C code, exposed to the R programmer as
Probably the easiest way to think
about it is that most of the extra
time is the overhead of calling a
function. So counting the number
of calls to R functions is going to
tell you how much overhead there is.
(Remember that functions call other
functions.)
On 26/06/2011 08:21, Jeff Newmiller
On Jun 26, 2011, at 2:56 AM, Alexander Engelhardt wrote:
Hey,
I just read another post about calling R from C. Someone on
stackoverflow (DWin makes me suspect its David W.?) referenced this: http://www.math.univ-montp2.fr/~pudlo/R_files/call_R.pdf
Which made me think: Why is a loop in R
4 matches
Mail list logo