[Rcpp-devel] Call by reference

Hao Ye hye at ucsd.edu
Wed Jul 29 20:01:58 CEST 2015


The data.table package might also be worth looking into.

Best,
--
Hao Ye
hye at ucsd.edu

> On Jul 29, 2015, at 10:37 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> 
> 
> On 29 July 2015 at 17:28, Rguy wrote:
> | The reason I am interested in using call by reference is that I am accessing
> | data frames with over a million rows and hundreds of columns. It is more
> | efficient to operate on such a data frame directly, as opposed to copying it
> | into and out of a function. In other words, I want to be *not* like R, which is
> | why I am interested in utilizing C++, which supports call by reference.
> 
> You misunderstand.  We communicate by SEXP.  Where the P stands for pointer.
> IE even with 
> 
>  R> M <- as.data.frame(matrix(rnorm(1e6, 1e3)))
>  R> object.size(M)
>  8000672 bytes
>  R>
> 
> we'd still only pass the same 56 bytes a SEXP takes. See eg
> https://cran.r-project.org/doc/manuals/R-ints.html#SEXPs and play with memory
> profiling in R.
> 
> Dirk 
> 
> -- 
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel



More information about the Rcpp-devel mailing list