RosettaCodeData/Task/Time-a-function/R/time-a-function-1.r

14 lines
209 B
R
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
# A task
foo <- function()
{
for(i in 1:10)
{
mat <- matrix(rnorm(1e6), nrow=1e3)
mat^-0.5
}
}
# Time the task
timer <- system.time(foo())
# Extract the processing time
timer["user.self"]