Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有
myFun = function(){ }
我知道
system.time(myFun)
将告诉我用于运行该功能的时间。问题是我想知道重复调用函数 1000 次需要多少,我该怎么办?
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