Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add Benchmark.

  • Loading branch information...
commit 8fddef6655d7094f09c7800678d3d4243f8f49d3 1 parent 49f7703
@vincenthz authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 Benchs/Bench.hs
View
24 Benchs/Bench.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE BangPatterns #-}
+module Main where
+
+import qualified Data.ByteString as B
+import qualified Crypto.MAC.SipHash as SipHash
+import Criterion.Main
+
+main = do
+ let !bs5 = B.pack [0..4]
+ !bs8 = B.pack [0..7]
+ !bs11 = B.pack [0..10]
+ !bs40 = B.pack [0..39]
+ !bs1Mb = B.pack . map fromIntegral $ [0..999999::Int]
+ let !k = SipHash.SipKey 0 0
+ let !hash = SipHash.hash k
+ defaultMain
+ [ bgroup "Hash"
+ [ bench "5" $ whnf hash bs5
+ , bench "8" $ whnf hash bs8
+ , bench "11" $ whnf hash bs11
+ , bench "40" $ whnf hash bs40
+ , bench "2^20" $ whnf hash bs1Mb
+ ]
+ ]
Please sign in to comment.
Something went wrong with that request. Please try again.