[Rcpp-devel] Deep copying a matrix

Etienne B. Racine etiennebr at gmail.com
Thu Jul 14 23:42:49 CEST 2011

> I find Rcpp makes getting back to C++ so much easier.

Totally agree. I've tried wraping some C++ code to Rcpp (really quick and
easy) and moving some code from R to C++ (that was a slightly harder, but I
was getting back to C++). All in all, I must say Rcpp is a really powerful
tool and quite quick. I wonder why there are not more functions written in
C++. As I read in one of your presentation, we're not talking about some 10
% improvement, but rather 10 folds improvement. My next challenge is making
it work under Windows.

If you have a suggestion as to where this little casting issue could be
> documented more
> easily, let us know.  There are arguably already too many features but then
> there just so mnay use cases, things to cover, ... so the docs will always
> be
> somewhat spotty.

I agree. I guess it will also build with time. Maybe a wiki could be usefull
? I'm not so wiki prone, but in that kind of situation (many use cases,
scattered information) maybe it could help. Just an idea, I'm not even
convinced of the gain/work ratio.
On a personal note, I learn a lot with examples, so if the examples in the
doc used a const, I guess I'd use a const before all my constuctions from
SEXP variables. I didn't found any clone example (I was focused on copy
keyword however).

> Lastly, regarding the deep vs shallow copy: I actually changed my mind on
> this and prefer shallow copies, esp once you pay attention to performance
> as
> eg in simulation and frequently executed code paths.
Take home message :
-Use const before objects build from SEXP
-Use clone only when needed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110714/f89d52d2/attachment-0001.htm>

More information about the Rcpp-devel mailing list