10

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, e.g. to see the algorithmic complexity?

Ideally, I pass the library a value of type Benchmarkable r => [(String, Int -> r)], i.e. 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.

Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139

1 Answers1

8

e.g. to see the algorithmic complexity?

There's a package for that:

http://hackage.haskell.org/package/complexity

However, I typically use QuickCheck to drive testing at random data sizes, then plot the result.

Don Stewart
  • 137,316
  • 36
  • 365
  • 468
  • 2
    Too bad, it seems the package has bit-rotted; its dependency hstats does not build in GHC 7.6. – Joachim Breitner Jul 02 '13 at 10:41
  • 1
    You're telling me, I patched that a year ago... but it isn't hard to fix, for anyone else reading - just get the version from github until the author uploads a new version (some time 2014 perhaps?) – Thomas M. DuBuisson Jul 02 '13 at 14:51