[Rcpp-devel] Forcing a shallow versus deep copy

Dirk Eddelbuettel edd at debian.org
Fri Jul 12 00:55:20 CEST 2013


Everybody has this existing example in their copy of Armadillo. 

I am running it here from SVN rather than the installed directory, but this
should not make a difference. Machine is my not-overly-powerful thinkpad used
for traveling:

edd at don:~/svn/rcpp/pkg/RcppArmadillo/inst/examples$ r fastLm.r 
Loading required package: methods

Attaching package: ‘Rcpp’

The following object is masked from ‘package:inline’:

    registerPlugin

                       test replications relative elapsed user.self sys.self
2         fLmTwoCasts(X, y)         5000    1.000   0.184     0.204    0.164
1          fLmOneCast(X, y)         5000    1.011   0.186     0.200    0.172
4   fastLmPureDotCall(X, y)         5000    1.141   0.210     0.236    0.184
3          fastLmPure(X, y)         5000    2.027   0.373     0.412    0.332
6              lm.fit(X, y)         5000    2.685   0.494     0.528    0.456
5 fastLm(frm, data = trees)         5000   36.380   6.694     7.332    6.028
7     lm(frm, data = trees)         5000   42.734   7.863     8.628    7.068
edd at don:~/svn/rcpp/pkg/RcppArmadillo/inst/examples$ 

What we are talking about here is the difference between 'fLmTwoCasts' and
'fLmOneCasts'.  If you use larger objects, the different with be larger.  But
the relative differences are tiny.

It would be nice to make this more elegant, and I look forward to Romain's
proposals, but methinks that we may well have bigger fish to fry.

Dirk, still in Sydney

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list