[R] R package "benchmark"

Benchmark package consists of only one function benchmark, which is a simple wrapper of system.time to evaluate expression of R code.

Usage:

benchmark(...,columns = c("test", "replications", "elapsed", "relative", "user.self", "sys.self",
"user.child", "sys.child"), order = "test", replications = 100, environment = parent.frame(), relative = "elapsed")

It means evaluate expression ... and return the results of c("test", "replications", "elapsed", "relative", "user.self", "sys.self",
"user.child", "sys.child")
. All column result can be choose which to return using column setting.

Now give the meaning of each column:

  • test means expression (R code) to be evaluated.
  • replications means the number of replications used within each individual benchmark.
  • elapsed means the total elapsed times for the currently running R process
  • user.self means ‘user.time’, which is the CPU time charged for the execution of user instructions of the calling process.
  • sys.selt mean ‘system.time’, which is the CPU time charged for execution by the system on behalf of the calling process.
  • user.child and sys.child are not available on Windows and will always be given as NA.
  • relative means the relative value or time using of the evaluated expressions.

So the we can use elapsed time to compare R processes, which can be seen relative directly.

From the blog,
the result of benchmark is

From the column relative, we see that

  • rbindlist is the fastest way
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值