On 10 December 2018 at 13:04, Jan van der Laan wrote:
| Small addendum: A large part of the performance gain in my example comes 
| from using NumericVector instead of std::vector<double>. Which avoids a 
| conversion. An example using std::copy with Numeric vector runs in the 
| same time as the version using memcpy.

+1

That sounds reasonable and matches my experience: std::memcpy is good yet
std::copy may itself be implemented with using it.  And ussing care with the
interface is important: std::vector<> has its own memory allocation scheme so
we cannot do without a copy which we notice here in the timings.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
_______________________________________________
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