Skip to contents
loading...

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.

Examples

test <- timing(Sys.sleep(0.5))
test
#> Time difference of 0.501 secs
attr(test, "details")
#> Time differences in secs
#>  user.self   sys.self    elapsed user.child  sys.child 
#>      0.001      0.000      0.501      0.000      0.000