On 27 August 2012 at 15:17, Peng Yu wrote:
| Hi Dirk,
| 
| > inlines uses .Call, so there is a slight logical problem here...  And yes,
| 
| What is the logical problem?

What inline's cxxfunction() gives you is an object which uses .Call.  So it
is a little hard to imagine how that could be faster than using .Call as it
also uses .Call.  More likely, it may reflect random fluctuations in your
setup as also suggested by Doug.
 
| > functions have overheads.
| 
| If that is the case, .Call("test", xx) should be faster than test(xx).
| But it is not (see below). This looks wired to me.

See above.  

Also, next time you post, please try digits=5 or 6.  The 20 digits you show
are entirely spurious.

Dirk
  
 
| >
| > | library(microbenchmark)
| > | microbenchmark(test(xx))
| > | microbenchmark(test_inline(xx))
| > | microbenchmark(.Call('test', xx))
| >
| > The normal idiom is a _single_ call so that you can compare:
| >
| >   microbenchmark(test(xx), test_inline(xx), .Call('test', xx))
| 
| Here is the output.
| 
| > microbenchmark(test(xx), test_inline(xx), .Call('test', xx))
| Unit: microseconds
|                expr                      min                       lq
|                  median                       uq
| max
| 1 .Call("test", xx) 94.831999999999993633537 96.090499999999991587174
| 97.557000000000002160050 99.762499999999988631316
| 128.83099999999998885869
| 2   test_inline(xx)  4.440000000000000390799  5.101499999999999701572
| 6.393000000000000682121  6.615000000000000213163
| 30.33899999999999863576
| 3          test(xx) 69.683000000000006934897 70.387500000000002842171
| 71.593500000000005911716 73.153500000000008185452
| 198.30899999999999749889
| 
| -- 
| Regards,
| Peng
| _______________________________________________
| 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

-- 
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