[Rcpp-devel] Rcpp Timer

Dirk Eddelbuettel edd at debian.org
Thu Dec 29 14:23:23 CET 2016


On 29 December 2016 at 14:55, Kaspar Märtens wrote:
| Hi, 
| 
| Trying out the Rcpp Timer example from http://gallery.rcpp.org/articles/
| using-the-rcpp-timer/ I was unable to reproduce similar results. The example
| output
| 
|     get/put g/p+rnorm()  empty loop 
|   1.967e+03   3.288e+03   6.400e-04 
| 
| compared to the output I see
| 
|     get/put g/p+rnorm()  empty loop
|    733.5265   1884.9589   1884.9601
| 
| Suspiciously, the empty loop appears to take the longest. Could these be
| cumulatively measured times here? 

It is possibly that there is a thinko / bug / error somewhere.  I just re-ran
it via sourceCpp() [ see below ] which is pretty much what Ruby + Jekyll do
to build the Rcpp Gallery pages.

The results will reflect the underlying machines a little but the difference
you show is much starker.  What is your OS / compiler?   Ubuntu 16.04 with
g++-5.3 here; page was original written with an older g++.

Dirk


Copy and paste below (and I just removed two lines pertaining to ESS which do
no matter here).

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

R> library(Rcpp)
R> sourceCpp("~/git/rcpp-gallery/src/2013-01-06-using-the-rcpp-timer.cpp")

R> useTimer()
    get/put g/p+rnorm()  empty loop 
    1620.67     3973.43     3973.44 
R> 


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


More information about the Rcpp-devel mailing list