r语言 - 如何计算系统.时间以微秒为单位



是否有办法改变system.time的精度?

system.time(sum(seq(1.0,10^4,1)))

转到如下:

round(system.time(sum(seq(1.0,10^4,1))),digits=6)

您应该使用microbenchmark包。

从包DESCRIPTION:

Package:            microbenchmark
Title:              Sub microsecond accurate timing functions.
Description:        Provides infrastructure to accurately measure and compare the execution time of R expressions.

最新更新