[Rcpp-devel] R.e. First foray into Rcpp and comparison of speed with R

Christian Gunning xian at unm.edu
Thu Sep 1 13:28:58 CEST 2011


> In R I was able to
> vectorize all within line computations, but in C++ I have to use explicit
> looping, right?

At a glance, I don't see any glaring speed-related flaws.  Honestly,
I'm curious to see what the R version of the Compute looks like.
Others might advise on the use of iterators...

>      w(i, t) = ped(i, t+3) - pa(i, t);

This brings up a question that I've been meaning to ask the list --
Last time I checked, with NumericVectors using myvec[i] was
significantly faster than myvec(i) (due to bound and NA checking?).
Now that I think of it, I seem to remember discussion of disabling
these checks with NumericMatrix et al.  Of course, no checking is just
another way to shoot my own foot -- I'm a big fan of myvec(i) in
day-to-day use :)

best,
-xian

-- 
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!


More information about the Rcpp-devel mailing list