summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorBodigrim <>2017-07-15 17:47:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-07-15 17:47:00 (GMT)
commitee978d3f2424b40f391b46b6a858ec86b672f227 (patch)
tree5356e64960b63f283aba8b7b6a8fe221f990d669 /bench
version 0.1.0.00.1.0.0
Diffstat (limited to 'bench')
-rw-r--r--bench/Bench.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/bench/Bench.hs b/bench/Bench.hs
new file mode 100644
index 0000000..c9a43aa
--- /dev/null
+++ b/bench/Bench.hs
@@ -0,0 +1,30 @@
+module Main where
+
+import Criterion.Main
+
+import Data.BitStream.WheelMapping
+
+doBench :: String -> (Word -> Word) -> Benchmark
+doBench name fn = bench name $ nf (sum . (map fn)) [0..46409]
+
+main = defaultMain
+ [ bgroup "toWheel . fromWheel"
+ [ doBench "2" $ toWheel2 . fromWheel2
+ , doBench "6" $ toWheel6 . fromWheel6
+ , doBench "30" $ toWheel30 . fromWheel30
+ , doBench "210" $ toWheel210 . fromWheel210
+ ]
+ , bgroup "toWheel"
+ [ doBench "2" $ toWheel2
+ , doBench "6" $ toWheel6
+ , doBench "30" $ toWheel30
+ , doBench "210" $ toWheel210
+ ]
+ , doBench "toIdx" $ toIdx
+ , bgroup "fromWheel"
+ [ doBench "2" $ fromWheel2
+ , doBench "6" $ fromWheel6
+ , doBench "30" $ fromWheel30
+ , doBench "210" $ fromWheel210
+ ]
+ ]