[R] Time-measurement in milliseconds

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 7 18:27:10 CET 2005


Be aware that the measurement will itself take more than a millisecond
from an interpreted language like R.

Please see the help page for Sys.time, and its suggestion of proc.time.
for(i in 1:100) print(proc.time()[3]) suggests this takes 3ms on my box.

On Mon, 7 Nov 2005, Sydler, Dominik wrote:

> Hi there
>
> I'm loking for a time-measurement to measure time-differences in
> milliseconds.
> On my search, I only found the following:
> - package "base": Sys.time()
>    -> only second-accuracy
> - package "R.utils": System$currentTimeMillis()
>    -> returns integer of milliseconds, but accuracy is only whole
> seconds too.
> At the moment I run every bit of code to measure 1000-times to be able
> to calculate time in milliseconds... ;-)
>
> Has anyone a method to get milliseconds?
>
> Thanks for any help.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list