[Rcpp-devel] usage question (avoiding data copies)

Greg Minshall minshall at umich.edu
Sat Mar 2 15:58:25 CET 2013

hi, all.  i've had great success speeding up my computations using
Rcpp/C++.  (thanks to the list for the help getting up and running.)


now, when i scale up (from a 554x415 matrix to a 2592x1936 matrix), my
run time slows down, and experimenting, it seems it's the cost of
copying my dataset between R and C++ that is taking the time.  (i drive
the process from R, and have 4 passes that are processed in C++.)

i could leave all the data in C++-land, but for investigating the data,
etc., i would really like to be able to access it from the R side.

any suggestions on how to proceed?  i'm currently shipping a list of S4
objects and a numeric matrix across the interface.  would converting
both to be reference classes allow me to avoid the copies, but still
access both from the R side?  (if i have to pay a performance penalty
for access, i'd rather pay it from the R side, as long as it isn't too

cheers, Greg

More information about the Rcpp-devel mailing list