[Rcpp-devel] Indexing vector with x(i) and x[i] gives remarkable difference in computing time

2014-11-27 Thread Søren Højsgaard
Dear all, By "accident" I noticed that indexing with x(i) and x[i] gives remarkable difference in computing time. For example: library(Rcpp) cppFunction(' IntegerVector insert1 (int n){ IntegerVector z(n); for (int i=0; ihttps://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Indexing vector with x(i) and x[i] gives remarkable difference in computing time

2014-11-27 Thread Romain Francois
> Le 27 nov. 2014 à 13:22, Søren Højsgaard a écrit : > > Dear all, > By "accident" I noticed that indexing with x(i) and x[i] gives remarkable > difference in computing time. For example: > > library(Rcpp) > cppFunction(' > IntegerVector insert1 (int n){ > IntegerVector z(n); > for (int i=0;