首页 > 解决方案 > 使用标准进行基准测试花费的时间太长

问题描述

我有一些想要使用标准进行测试的基准。问题是我试图进行基准测试的功能可能需要很长时间(100 秒)。

我的设置是这样的

benchmarks128StatesMediumFormulas =
[
    bench "Testing for transition system t128StatesAgents1 and feasy"
          (nf (myFuntion x1 x2) 2),
    bench "Testing for transition system t128StatesAgents2 and feasy"
          (nf (myFunction x1 x2 feasy) 2)
]

我的函数是我需要进行基准测试的函数,x1 和 x2 在文件中的其他位置定义。

然后我做

main :: IO ()
main = defaultMain
  [
    bgroup "for one agent easy:" benchmarks128StatesEasyFormulas
] 

然后我得到类似的输出

benchmarking 128 states and easy formulas:/Testing for transition system t128StatesAgents2 and fEasy1
time                 115.5 s    (111.1 s .. 119.2 s)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 115.7 s    (115.0 s .. 116.7 s)
std dev              983.9 ms   (389.9 ms .. 1.263 s)
variance introduced by outliers: 19% (moderately inflated)

问题是,产生这个结果需要一个多小时。

这是因为标准运行了太多样本吗?还是有什么其他问题??我可以解决这个问题吗?

我读了一些关于--time-limit选项的东西,但不太明白它是如何工作的。如果解决方案围绕使用--time-limit我如何在使用时传递此参数stack benck

标签: haskellcriterion

解决方案


推荐阅读