commit fae1f9b7ef3a2ddfa4719e218d42949bf8813edb parent 32da40f46016ca952d2c4e90adb6cbee7f1301ad Author: Jared Tobin <jared@jtobin.io> Date: Thu, 12 Dec 2024 17:08:35 -0330 bench: base32 cases Diffstat:
M | bench/Main.hs | | | 21 | ++++++++++++++++++++- |
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/bench/Main.hs b/bench/Main.hs @@ -1,3 +1,22 @@ +{-# LANGUAGE OverloadedStrings #-} + module Main where -main = pure () +import Criterion.Main +import qualified Data.ByteString.Bech32 as B32 + +main :: IO () +main = defaultMain [ + suite + ] + +suite :: Benchmark +suite = env setup $ \big -> + bgroup "ppad-bech32" [ + bench "base32 120b" $ whnf B32.base32 "jtobin was here" + , bench "base32 240b" $ whnf B32.base32 "jtobin was herejtobin was here" + , bench "base32 1200b" $ whnf B32.base32 big + ] + where + setup = pure . mconcat . take 10 $ repeat "jtobin was here" +