For completeness, on Linux I get (with thanks to Davor providing his package;
and omitting compiler warnings over signed/unsigned comparisons in Peng's
code) the following:

edd@max:/tmp$ r pengyu3.r 
                                 test replications elapsed relative user.self
2                     test_inline(xx)         1000   6.173 1.000000     6.144
3 .Call("test", xx, package = "test")         1000   6.228 1.008910     6.217
1                            test(xx)         1000   6.657 1.078406     6.280
edd@max:/tmp$ 
edd@max:/tmp$ r pengyu3.r 
                                 test replications elapsed relative user.self
2                     test_inline(xx)         1000   6.177 1.000000     6.152
3 .Call("test", xx, package = "test")         1000   6.180 1.000486     6.169
1                            test(xx)         1000   6.485 1.049862     6.132
edd@max:/tmp$ 

So even with 1000 replications, the inter-experiment variation is still large
and almost as big as the difference between the second and third method
itself.  

All told, inline has a slight edge, and the simple layer of an additional
function call in test() --- which does nothing but the .Call() we also run
directly -- dominates.  That doesn't take away from the fact that just about
every experienced R user will recommend use of a package.

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com  
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to