[英]Run Haskell benchmarks on inputs of varying size
Often I'd like to compare the runtime performance of multiple implementations of the same function. 我经常想比较同一函数的多个实现的运行时性能。 For individual inputs, criterion is a good tool.
对于个人投入,标准是一个很好的工具。
But what is an easy way to plot the performance of the code over varying input size, eg to see the algorithmic complexity? 但是,在不同的输入大小上绘制代码性能的简单方法是什么,例如,查看算法的复杂性?
Ideally, I pass the library a value of type Benchmarkable r => [(String, Int -> r)]
, ie a list of size-dependent benchmarks, and the library will automatically find a the sensible input range for each value and creates a nice plot from it. 理想情况下,我向库传递一个类型为
Benchmarkable r => [(String, Int -> r)]
,即依赖于大小的基准列表,库将自动为每个值找到合理的输入范围并创建一个很好的情节。
eg to see the algorithmic complexity?
例如,看看算法的复杂性?
There's a package for that: 有一个包:
http://hackage.haskell.org/package/complexity http://hackage.haskell.org/package/complexity
However, I typically use QuickCheck to drive testing at random data sizes, then plot the result. 但是,我通常使用QuickCheck来驱动随机数据大小的测试,然后绘制结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.