Benchmarking with criterion takes too long

390 Views Asked by At

I have a few benchmarks that would like to test using criterion. The problem is that the function I am trying to benchmark may take a very long time(100 seconds).

My setup is something like this

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)
]

where my function is the function I need to benchmark and x1 and x2 are defined somewhere else in the file.

Then I do

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

Then i get an output of something like

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)

The problem is that this more then an hour to produce that outcome.

Is this because criterion is running too many sample?? Or is there some other problem?? Can I work around this??

I read something about --time-limit option but did not quite understand how it works. If the solution revolves around using --time-limit how can I pass this argument when using stack benck?

0

There are 0 best solutions below