[Rcpp-devel] R vectorisation vs. C++ vectorisation
h.wickham at gmail.com
Tue Nov 20 16:56:51 CET 2012
>> I think you could do it a bit more elegantly with
>> gender <- 0.75 + female * 0.5
>> but pmin and pmax are "real" primitives, so I think it's fine to use them.
> In the folklore ifelse, pmin and pmax are know to be slow. I know that
> there was some work on pmin and pmax but I think they are still more
> sluggish than desired.
There's certainly lots of micro-optimisations that you could do to
both the R code and the C code, but I think they start to go beyond
what you can expect a reasonably knowledgeable R user to do in
practice. For teaching Rcpp, we have to strike the right balance
between knowledge needed and expected payoff.
RStudio / Rice University
More information about the Rcpp-devel