> No probs - and sorry for the unclear post! Thanks

No worries. There are some important points here, some that have been
raised repeatedly.

On Thu, Aug 18, 2011 at 7:57 AM,
<rcpp-devel-requ...@r-forge.wu-wien.ac.at> wrote:
>
> R> (1:50)[runif(10,0,20)]
>
> And I was wondering if I had missed some sugar-type of construct that would 
> allow me to avoid the explicit 1e7 loop - and instead make use of some Rcpp 
> vectorised/optimised/ machinery. Christian's sugg' of allowing double->int 
> did speed things up enough, by me to chuck away the "floor"...

A big point here is that loops aren't "bad" in C++ -- the speed
penalties are much less if you're using pure C++ within them, not
making spurious function calls in them, etc.  Sugar is exactly what
the name implies -- syntactic sugar that beautifies code. It's not
secret turbo-sauce -- that's what the compiler is for.

-xian
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to