haskell / haskell/criterion

Add `deepseq` on the input for `nf` and `whnf`

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

Description

This is to ensure that the input evaluation is not involved in the execution of the benchmark.

Here is the patch that I'm suggesting:

```diff
-nf :: NFData b => (a -> b) -> a -> Benchmarkable
-nf f x = toBenchmarkable (nf' rnf f x)
+nf :: (NFData a, NFData b) => (a -> b) -> a -> Benchmarkable
+nf f x = deepseq x (toBenchmarkable (nf' rnf f x))
```

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.