You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

bench::mark未返回mean和max运行时长,与帮助文档不符求解答

Hey there! Let me help you figure out why you're not seeing mean and max in your bench::mark() results.

The issue boils down to the version of the bench package you're using (1.0.4) being an older release. Back in this version, the default output of bench::mark() only included metrics like min, median, itr/sec, etc.—mean and max weren't part of the default result columns.

But don't worry, you have two solid ways to get those values:

  • Calculate them manually from raw time data: The time column in your result object holds all individual run times from the benchmark. You can compute mean and max directly from it:
    # Get mean run time
    mean(res$time)
    # Get max run time
    max(res$time)
    
  • Upgrade the bench package: If you update to a newer version (2.0.0 or later), bench::mark() will include mean and max in the default output automatically. You can even customize which metrics show up using the summary parameter:
    # In newer versions, specify exactly which stats you want
    res <- bench::mark(rnorm(1e5), summary = c("min", "median", "mean", "max"))
    names(res)
    

The reason this feels conflicting with the help docs is probably because you're looking at documentation for a newer version of bench—the docs were updated to reflect the expanded default metrics in later releases.

内容的提问来源于stack exchange,提问作者Sebastian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 10:32:31