From e0c392cee1274f173154e5acd9b4f9fd8a2341f2 Mon Sep 17 00:00:00 2001 From: Nicholas Clarke Date: Mon, 14 Sep 2020 14:40:45 +0200 Subject: [PATCH] Add benchmark for 'likelihood'. This is the main component of the reward calculation. --- .../chain-and-ledger/shelley-spec-ledger-test/bench/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shelley/chain-and-ledger/shelley-spec-ledger-test/bench/Main.hs b/shelley/chain-and-ledger/shelley-spec-ledger-test/bench/Main.hs index 3ae2ea7fb6a..41e59e8e109 100644 --- a/shelley/chain-and-ledger/shelley-spec-ledger-test/bench/Main.hs +++ b/shelley/chain-and-ledger/shelley-spec-ledger-test/bench/Main.hs @@ -22,6 +22,7 @@ import BenchValidation -- How to compute an initial state with N StakePools import Cardano.Ledger.Era (Crypto (..)) +import Cardano.Slotting.Slot (EpochSize (..)) import Control.DeepSeq (NFData) import Control.Iterate.SetAlgebra (dom, forwards, keysEqual, (▷), (◁)) import Control.Iterate.SetAlgebraInternal (compile, compute, run) @@ -57,6 +58,7 @@ import Shelley.Spec.Ledger.LedgerState UTxOState (..), stakeDistr, ) +import Shelley.Spec.Ledger.Rewards (likelihood) import Shelley.Spec.Ledger.UTxO (UTxO) import System.IO.Unsafe (unsafePerformIO) import Test.QuickCheck.Gen as QC @@ -483,6 +485,7 @@ main = (generate $ genChainInEpoch 5) ( \cs -> bench "createRUpd" $ whnf (createRUpd testGlobals) cs - ) + ), + bench "likelihood" $ whnf (likelihood 1234 0.1) (EpochSize 10000) ] ]