Reputation: 535
Suppose i have
myFun = function(){
}
I know that
system.time(myFun)
will tell me the time used to run the function. The question is I want to know how much would it take to repeat the calling the function 1000 times, what should I do?
Upvotes: 0
Views: 74
Reputation: 3037
library(microbenchmark)
myFun <- function() {Sys.time()}
microbenchmark(myFun(), times = 1000)
Unit: microseconds
expr min lq median uq max neval
myFun() 9.893 11.035 11.416 12.176 60.119 1000
Upvotes: 3