[Rcpp-devel] Rcpp Timer

Dirk Eddelbuettel edd at debian.org
Fri Dec 30 20:58:10 CET 2016


On 30 December 2016 at 20:38, Romain Francois wrote:
| It made more sense to track times since an origin, esp when you might use several timers in case you use multiple threads. 

Using an offset to an origin (and hence differences) is also a sensible way
to deal with higher resolutions.  We cannot natively represent nanoseconds
(which the Timer class uses) in R with base types: doubles use 53 bits
precision which gets us a bit more than microseconds, and ints are 32 bit --
so conversion would be lossy.  (The nanoseconds package I just releases uses
bit64::integer64 which gets us nanosecond, but that is a higher-level depend
and not something we want to depend on at the Rcpp level).

Whether cumulative times, or individual measurements is better is still open
fore debate.  In any event, I fixed the Rcpp Gallery story at

    http://gallery.rcpp.org/articles/using-the-rcpp-timer/

Dirk
 
| > Le 30 déc. 2016 à 13:37, Dirk Eddelbuettel <edd at debian.org> a écrit :
| > 
| > 
| > On 29 December 2016 at 11:25, Jonathan Christensen wrote:
| > | Hi Kaspar and Dirk,
| > | 
| > | It is indeed cumulative. Previously (presumably when that gallery page was
| > | written) it was not cumulative, but Romain Francois changed the behavior of the
| > | step() function several years ago, in this commit: https://github.com/RcppCore/
| > | Rcpp/commit/e295b2b178de55291e63705966368404bb0ce5e1.
| > 
| > Nice catch.
| > 
| > | There is no indication or reasoning about changing the behavior, so it may be
| > | that making it cumulative was unintentional.
| > 
| > Let's presume it was intentional to the author of the change -- but as you
| > rightly point out, it did of course change and reverse previous behaviour.
| > 
| > We could easily add a toggle to the constructor to get an either/or behaviour.
| > 
| > 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
| 

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


More information about the Rcpp-devel mailing list