timing: Timing of R expressions

View source: R/misc.R

timingR Documentation

Timing of R expressions

Description

Similar to system.time() but returns a more convenient 'difftime' object with the overall timing (details are stored in the details attribute).

Usage

timing(expr, gc.first = TRUE)

Arguments

expr

Valid R expression to be timed. If missing, proc.time() is used instead and the function returns the time the currently running R process has already taken.

gc.first

Logical - should a garbage collection be performed immediately before the timing? Default is TRUE.

See Also

system.time(), proc.time()

Examples

test <- timing(Sys.sleep(0.5))
test
attr(test, "details")

SciViews/SciViews documentation built on Sept. 16, 2023, 10:26 p.m.