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

14 lines
209 B
R

# 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"]