haskell / haskell/criterion

How can I do shorter benchmarks?

Open
#210 2 comments 0 reactions 0 assignees View on GitHub
Documentation
Dominant language
Haskell
Stars
523
Forks
89
PR merge metrics
No merged PRs in 30d

Description

```
module Main where

import Criterion.Types
import Criterion.Main

myConfig :: Config
myConfig = defaultConfig {
resamples = 1
, timeLimit = 0.01
}

main :: IO ()
main = do
let f = (\x -> bench (show x) $ nf xyz x)
defaultMainWith myConfig [
bgroup "fib" [
env (pure 400000) f
, env (pure 100) f
, env (pure 200) f
]
]

xyz :: Int -> [Double]
xyz 0 = []
xyz _ = [fromIntegral 1000]

```

I was hoping I could quickly benchmark an example like this - but it seems to be taking around 4 seconds - to do numerous(?) runs.

Have I misunderstood the `resamples` / `timeLimit` values?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.