commit 8e0da908a4b40fc350164b26de2f7ce3c8707868
parent 231a4e8cb760549260020caa81fd8415283bbbb8
Author: Jared Tobin <jared@jtobin.io>
Date: Fri, 24 Jan 2025 10:55:19 +0400
bench: quotrem_by1_gen
Diffstat:
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/bench/Main.hs b/bench/Main.hs
@@ -13,8 +13,10 @@ import Prelude hiding (or, and, div, mod)
import qualified Prelude (div)
instance NFData W.Word256
-instance NFData W.Word512
instance NFData W.Word320
+instance NFData W.Word512
+instance NFData W.Word576
+instance NFData W.Word640
or_baseline :: Benchmark
or_baseline = bench "or (baseline)" $ nf ((.|.) w0) w1 where
@@ -160,15 +162,15 @@ quotrem_by1 = env setup $ \ ~(quo, u, d) ->
d = B.complement 50
pure (quo, u, d)
-quotrem_by1_256 :: Benchmark
-quotrem_by1_256 =
- bench "quotrem_by1_256" $
- nf (W.quotrem_by1_256 (W.Word256 300 200 100 0)) (B.complement 50)
+quotrem_by1_gen :: Benchmark
+quotrem_by1_gen =
+ bench "quotrem_by1_gen" $
+ nf (W.quotrem_by1_gen (W.Word576 300 200 100 0 0 0 0 0 0) 3) (B.complement 50)
main :: IO ()
main = defaultMain [
quotrem_by1
- , quotrem_by1_256
+ , quotrem_by1_gen
, mul_baseline
, mul
, div_baseline
diff --git a/bench/Weight.hs b/bench/Weight.hs
@@ -12,8 +12,10 @@ import qualified Data.Word.Extended as E
import qualified Weigh as W
instance NFData E.Word256
-instance NFData E.Word512
instance NFData E.Word320
+instance NFData E.Word512
+instance NFData E.Word576
+instance NFData E.Word640
i0, i1 :: Integer
i0 = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed
@@ -54,6 +56,6 @@ main = do
W.func "div (baseline)" (Prelude.div i2) i3
W.func "div" (E.div w2) w3
W.io "quotrem_by1" (E.quotrem_by1 q u) d
- W.func "quotrem_by1_256"
- (E.quotrem_by1_256 (E.Word256 300 200 100 0)) (B.complement 50)
+ W.func "quotrem_by1_gen"
+ (E.quotrem_by1_gen (E.Word576 300 200 100 0 0 0 0 0 0) 3) (B.complement 50)