Created
October 22, 2018 17:49
-
-
Save Nolrai/359d260430aa9dfc2efd89fc2fbfe823 to your computer and use it in GitHub Desktop.
Criterion Weirdness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Maxwell-0.0.0: benchmarks | |
Running 1 benchmarks... | |
Benchmark Maxwell-benchmarks: RUNNING... | |
benchmarking fib/30 | |
time 51.14 ms (49.98 ms .. 52.85 ms) | |
0.994 R2 (0.977 R2 .. 1.000 R2) | |
mean 51.82 ms (51.06 ms .. 53.95 ms) | |
std dev 2.150 ms (1.031 ms .. 3.451 ms) | |
variance introduced by outliers: 14% (moderately inflated) | |
benchmarking fib/30 | |
time 50.76 ms (50.45 ms .. 50.98 ms) | |
1.000 R2 (1.000 R2 .. 1.000 R2) | |
mean 50.84 ms (50.64 ms .. 51.15 ms) | |
std dev 430.5 s (240.5 s .. 728.9 s) | |
benchmarking fib/30 | |
time 50.72 ms (50.39 ms .. 51.04 ms) | |
1.000 R2 (1.000 R2 .. 1.000 R2) | |
mean 50.87 ms (50.68 ms .. 51.12 ms) | |
std dev 418.5 s (261.5 s .. 606.5 s) | |
benchmarking fib/nub | |
time 50.75 ms (50.56 ms .. 50.96 ms) | |
1.000 R2 (1.000 R2 .. 1.000 R2) | |
mean 50.97 ms (50.73 ms .. 51.60 ms) | |
std dev 681.4 s (220.0 s .. 1.151 ms) | |
Benchmark Maxwell-benchmarks: FINISH | |
Completed 2 action(s). | |
-} | |
-- You can benchmark your code quickly and effectively with Criterion. See its | |
-- website for help: <http://www.serpentine.com/criterion/>. | |
import Criterion.Main | |
fib :: Integer -> Integer | |
fib m | m < 0 = error "negative!" | |
| otherwise = go m | |
where go 0 = 0 | |
go 1 = 1 | |
go n = go (n-1) + go (n-2) | |
main :: IO () | |
main = defaultMain [ | |
bgroup "fib" [ bench "30" $ whnf fib 30 | |
, bench "30" $ whnf fib 30 | |
, bench "30" $ whnf fib 30 | |
, bench "30" $ whnf fib 30 | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment