fixed

Pure Haskell large fixed-width integers.
git clone git://git.ppad.tech/fixed.git
Log | Files | Refs | README | LICENSE

commit bf214e241ea0b58f75a6abf26a217792c6643976
parent 428501a36b90fe412ecfe80a2a8324868e0a35dd
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 23 Nov 2025 16:02:21 +0400

bench: formatting fixes

Diffstat:
Mbench/Main.hs | 85++++++++++++++++++++++++++-----------------------------------------------------
1 file changed, 28 insertions(+), 57 deletions(-)

diff --git a/bench/Main.hs b/bench/Main.hs @@ -4,7 +4,6 @@ module Main where -import qualified Data.Word.Wider as W import qualified Numeric.Montgomery.Secp256k1.Curve as C import qualified Numeric.Montgomery.Secp256k1.Scalar as S import Criterion.Main @@ -22,50 +21,34 @@ main = defaultMain [ add :: Benchmark add = bgroup "add" [ - bench "curve: M(1) + M(2)" $ nf - (C.add C.one) - (C.to (W.to 2)) - , bench "curve: M(1) + M(2 ^ 255 - 19)" $ nf - (C.add C.one) - (C.to (W.to (2 ^ 255 - 19))) - , bench "scalar: M(1) + M(2)" $ nf - (S.add S.one) - (S.to (W.to 2)) - , bench "scalar: M(1) + M(2 ^ 255 - 19)" $ nf - (S.add S.one) - (S.to (W.to (2 ^ 255 - 19))) + bench "curve: M(1) + M(2)" $ nf (C.add 1) 2 + , bench "curve: M(1) + M(2 ^ 255 - 19)" $ nf (C.add 1) (2 ^ 255 - 19) + , bench "scalar: M(1) + M(2)" $ nf (S.add 1) 2 + , bench "scalar: M(1) + M(2 ^ 255 - 19)" $ nf (S.add 1) (2 ^ 255 - 19) ] sub :: Benchmark sub = bgroup "sub" [ bench "curve: M(2 ^ 255 - 1) - M(1)" $ nf - (C.sub (C.to (W.to (2 ^ 255 - 1)))) - C.one + (C.sub (2 ^ 255 - 1)) + 1 , bench "curve: M(2 ^ 255 - 1) - M(2 ^ 255 - 19)" $ nf - (C.sub (C.to (W.to (2 ^ 255 - 1)))) - (C.to (W.to (2 ^ 255 - 19))) + (C.sub (2 ^ 255 - 1)) + (2 ^ 255 - 19) , bench "scalar: M(2 ^ 255 - 1) - M(1)" $ nf - (S.sub (S.to (W.to (2 ^ 255 - 1)))) - S.one + (S.sub (2 ^ 255 - 1)) + 1 , bench "scalar: M(2 ^ 255 - 1) - M(2 ^ 255 - 19)" $ nf - (S.sub (S.to (W.to (2 ^ 255 - 1)))) - (S.to (W.to (2 ^ 255 - 19))) + (S.sub (2 ^ 255 - 1)) + (2 ^ 255 - 19) ] mul :: Benchmark mul = bgroup "mul" [ - bench "curve: M(2) * M(2)" $ nf - (C.mul (C.to (W.to 2))) - (C.to (W.to 2)) - , bench "curve: M(2) * M(2 ^ 255 - 19)" $ nf - (C.mul (C.to (W.to 2))) - (C.to (W.to (2 ^ 255 - 19))) - , bench "scalar: M(2) * M(2)" $ nf - (S.mul (S.to (W.to 2))) - (S.to (W.to 2)) - , bench "scalar: M(2) * M(2 ^ 255 - 19)" $ nf - (S.mul (S.to (W.to 2))) - (S.to (W.to (2 ^ 255 - 19))) + bench "curve: M(2) * M(2)" $ nf (C.mul 2) 2 + , bench "curve: M(2) * M(2 ^ 255 - 19)" $ nf (C.mul 2) (2 ^ 255 - 19) + , bench "scalar: M(2) * M(2)" $ nf (S.mul 2) 2 + , bench "scalar: M(2) * M(2 ^ 255 - 19)" $ nf (S.mul 2) (2 ^ 255 - 19) ] sqr :: Benchmark @@ -78,37 +61,25 @@ sqr = bgroup "sqr" [ inv :: Benchmark inv = bgroup "inv" [ - bench "curve: M(2) ^ -1" $ nf C.inv - (C.to (W.to 2)) - , bench "curve: M(2 ^ 255 - 19) ^ -1" $ nf C.inv - (C.to (W.to (2 ^ 255 - 19))) - , bench "scalar: M(2) ^ -1" $ nf S.inv - (S.to (W.to 2)) - , bench "scalar: M(2 ^ 255 - 19) ^ -1" $ nf S.inv - (S.to (W.to (2 ^ 255 - 19))) + bench "curve: M(2) ^ -1" $ nf C.inv 2 + , bench "curve: M(2 ^ 255 - 19) ^ -1" $ nf C.inv (2 ^ 255 - 19) + , bench "scalar: M(2) ^ -1" $ nf S.inv 2 + , bench "scalar: M(2 ^ 255 - 19) ^ -1" $ nf S.inv (2 ^ 255 - 19) ] redc :: Benchmark redc = bgroup "redc" [ - bench "curve: REDC(M(2), M(2))" $ nf (C.redc 2) - 2 - , bench "curve: REDC(M(2), M(2 ^ 255 - 19))" $ nf (C.redc 2) - (2 ^ 255 - 19) - , bench "scalar: REDC(M(2), M(2))" $ nf (S.redc 2) - 2 - , bench "scalar: REDC(M(2), M(2 ^ 255 - 19))" $ nf (S.redc 2) - (2 ^ 255 - 19) + bench "curve: REDC(M(2), M(2))" $ nf (C.redc 2) 2 + , bench "curve: REDC(M(2), M(2 ^ 255 - 19))" $ nf (C.redc 2) (2 ^ 255 - 19) + , bench "scalar: REDC(M(2), M(2))" $ nf (S.redc 2) 2 + , bench "scalar: REDC(M(2), M(2 ^ 255 - 19))" $ nf (S.redc 2) (2 ^ 255 - 19) ] retr :: Benchmark retr = bgroup "retr" [ - bench "curve: RETR(M(2))" $ nf C.retr - 2 - , bench "curve: RETR(M(2 ^ 255 - 19))" $ nf C.retr - (2 ^ 255 - 19) - , bench "scalar: RETR(M(2))" $ nf S.retr - 2 - , bench "scalar: RETR(M(2 ^ 255 - 19))" $ nf S.retr - (2 ^ 255 - 19) + bench "curve: RETR(M(2))" $ nf C.retr 2 + , bench "curve: RETR(M(2 ^ 255 - 19))" $ nf C.retr (2 ^ 255 - 19) + , bench "scalar: RETR(M(2))" $ nf S.retr 2 + , bench "scalar: RETR(M(2 ^ 255 - 19))" $ nf S.retr (2 ^ 255 - 19) ]