如何以微秒计算system.time?

时间:2014-06-18 21:25:18

标签: r performance

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

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

类似于:

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

1 个答案:

答案 0 :(得分:1)

您应该使用包microbenchmark来实现此目的。

从包DESCRIPTION

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