Re: [Rcpp-devel] Using pointers with Numeric Vectors

2012-12-21 Thread Romain Francois
Hello, I'm arriving after the battle here. Let's clear out some misconceptions. The copy constructor of NumericVector is very cheap, it just copies a pointer to the underlying R object, i.e. the data is not copied. This is the way Rcpp classes are implemented, they encapsulate an R object and

Re: [Rcpp-devel] Using pointers with Numeric Vectors

2012-12-20 Thread Dirk Eddelbuettel
On 20 December 2012 at 13:25, Alon Honig wrote: | Thank you for providing a point of reference with regards to speed. Dirk's | examples have ratios of 60:1 causing me to rethink my approach. That is __obviously__ problem dependent. We have seen anything from more than 10k (for somewhat degenera

Re: [Rcpp-devel] Using pointers with Numeric Vectors

2012-12-20 Thread Dirk Eddelbuettel
On 20 December 2012 at 12:35, Alon Honig wrote: | My current RCPP program is only 4 times faster than its R byte code compiled | equivalent. I am trying to speed up my code and from what I understand using | pointers prevents an external function from copying the entire object when | executing its

Re: [Rcpp-devel] Using pointers with Numeric Vectors

2012-12-20 Thread Alon Honig
Thank you JJ, that makes sense. I had no idea that R could be so taxing when bench-marking. On Thu, Dec 20, 2012 at 1:27 PM, JJ Allaire wrote: > It's possible that the overhead of making R function calls is swamping all > of the other performance data here. I've re-written the example w/ > sourc

Re: [Rcpp-devel] Using pointers with Numeric Vectors

2012-12-20 Thread Alon Honig
Thank you for providing a point of reference with regards to speed. Dirk's examples have ratios of 60:1 causing me to rethink my approach. On Thu, Dec 20, 2012 at 1:18 PM, H Xiong wrote: > Hi Alon, > > I am only a user, not a developer, of Rcpp, so I will offer some > observations only. > > On T

[Rcpp-devel] Using pointers with Numeric Vectors

2012-12-20 Thread Alon Honig
My current RCPP program is only 4 times faster than its R byte code compiled equivalent. I am trying to speed up my code and from what I understand using pointers prevents an external function from copying the entire object when executing its methods. I am having difficulty finding salient exampl