简体   繁体   English

使用 AutoBench 对大输入进行测试时,标准报告无效

[英]Invalid Criterion report when testing on large inputs with AutoBench

I am working with AutoBench since a few days testing performances of Euler's sieve on different input sizes.几天以来,我一直在使用 AutoBench 测试欧拉筛在不同输入尺寸上的性能。

My tests simply asks for the nth prime inside the list generated by Euler's sieve.我的测试只是要求欧拉筛生成的列表中的第 n 个素数。

While Criterion works well on small inputs for n, it doesn't seem to produce a valid report when n is greater than 7000.虽然 Criterion 在 n 的小输入上效果很好,但当 n 大于 7000 时,它似乎无法生成有效的报告。

Here is my Input.hs file tested:这是我测试的 Input.hs 文件:

eS :: Int -> Int
eS x = (eulerSieve [2..]) !! x where
  eulerSieve cs@(p:tcs) = p:eulerSieve (minus tcs (map (p*) cs))

tDat :: UnaryTestData Int
tDat  = 
  [ (1000, return 1000)
  , (2000, return 2000)
  , (3000, return 3000)
  , (4000, return 4000)
  , (5000, return 5000)
  , (6000, return 6000)
  , (7000, return 7000)
  , (8000, return 8000)
  , (9000, return 9000)
  , (10000, return 10000)
  , (11000, return 11000)
  , (12000, return 12000)
  , (13000, return 13000)
  , (14000, return 14000)
  , (15000, return 15000)
  , (16000, return 16000)
  , (17000, return 17000)
  , (18000, return 18000)
  , (19000, return 19000)
  , (20000, return 20000)
  ]

ts :: TestSuite 
ts  = def {
  _progs = ["eS"],
  _dataOpts = Manual "tDat"
}

And this is the error I am getting:这是我得到的错误:

benchmarking Input Size 8000/Input.eS
 • Executed benchmarking file ✔
 • Generating test report
File error: Invalid Criterion report: Error in $: not enough input
Testing cancelled. Press any key to exit... 
Leaving AutoBench.

I think it is something related to the time execution needed for the procedure to answer with the nth prime but I haven't found anything online but the official documentation which doesn't mention anything about it.我认为这与程序以第 n 个素数回答所需的时间执行有关,但我没有在网上找到任何东西,但官方文档没有提到任何关于它的内容。

After some profiling I found that for n greater than 7000, the Euler procedure quickly saturates the ram thus causing Criterion to crash.经过一些分析后,我发现当 n 大于 7000 时,欧拉程序会迅速使 ram 饱和,从而导致 Criterion 崩溃。

The only ways to overcome this problem are increasing your ram or switching to a different algorithm/implementation.克服这个问题的唯一方法是增加内存或切换到不同的算法/实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM