Skip to content

Commit 643e2eb

Browse files
committed
Nomenclature: "weight boost" instead of "boosted weight"
1 parent 1390449 commit 643e2eb

File tree

2 files changed

+15
-15
lines changed
  • ouroboros-consensus
    • bench/PerasCertDB-bench
    • src/ouroboros-consensus/Ouroboros/Consensus/Peras

2 files changed

+15
-15
lines changed

ouroboros-consensus/bench/PerasCertDB-bench/Main.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
-- | This module contains benchmarks for Peras chain weight calculation as
55
-- implemented by the by the
6-
-- 'Ouroboros.Consensus.Peras.Weight.boostedWeightForFragment' function.
6+
-- 'Ouroboros.Consensus.Peras.Weight.weightBoostOfFragment' function.
77
--
88
-- We benchmark the calculation on a static sequence of chain fragments of increasing
99
-- length, ranging from 0 to around 8640, with a sampling rate of 100. The chain fragments
@@ -16,8 +16,8 @@ import Numeric.Natural (Natural)
1616
import Ouroboros.Consensus.Block (PerasWeight (PerasWeight), SlotNo (..))
1717
import Ouroboros.Consensus.Peras.Weight
1818
( PerasWeightSnapshot
19-
, boostedWeightForFragment
2019
, mkPerasWeightSnapshot
20+
, weightBoostOfFragment
2121
)
2222
import Ouroboros.Network.AnchoredFragment qualified as AF
2323
import Test.Ouroboros.Storage.TestBlock (TestBlock (..), TestBody (..), TestHeader (..))
@@ -49,7 +49,7 @@ benchmarkParams =
4949

5050
main :: IO ()
5151
main =
52-
Test.Tasty.Bench.defaultMain $ map benchBoostedWeightForFragment inputs
52+
Test.Tasty.Bench.defaultMain $ map benchWeightBoostOfFragment inputs
5353
where
5454
-- NOTE: we do not use the 'env' combinator to set up the test data since
5555
-- it requires 'NFData' for 'AF.AnchoredFragment'. While the necessary
@@ -62,11 +62,11 @@ main =
6262
zip [0 ..] $
6363
zip (map uniformWeightSnapshot fragments) fragments
6464

65-
benchBoostedWeightForFragment ::
65+
benchWeightBoostOfFragment ::
6666
(Natural, (PerasWeightSnapshot TestBlock, AF.AnchoredFragment TestBlock)) -> Benchmark
67-
benchBoostedWeightForFragment (i, (weightSnapshot, fragment)) =
68-
bench ("boostedWeightForFragment of length " <> show i) $
69-
whnf (boostedWeightForFragment weightSnapshot) fragment
67+
benchWeightBoostOfFragment (i, (weightSnapshot, fragment)) =
68+
bench ("weightBoostOfFragment of length " <> show i) $
69+
whnf (weightBoostOfFragment weightSnapshot) fragment
7070

7171
-- | An infinite list of chain fragments
7272
fragments :: [AF.AnchoredFragment TestBlock]

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Peras/Weight.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module Ouroboros.Consensus.Peras.Weight
1313
, perasWeightSnapshotToList
1414
, addToPerasWeightSnapshot
1515
, removeFromPerasWeightSnapshot
16-
, boostedWeightForPoint
17-
, boostedWeightForFragment
16+
, weightBoostOfPoint
17+
, weightBoostOfFragment
1818
) where
1919

2020
import Data.Foldable as Foldable (foldl')
@@ -71,21 +71,21 @@ removeFromPerasWeightSnapshot pt (PerasWeight weight) =
7171
| w > weight = Just $ PerasWeight (w - weight)
7272
| otherwise = Nothing
7373

74-
boostedWeightForPoint ::
74+
weightBoostOfPoint ::
7575
forall blk.
7676
StandardHash blk =>
7777
PerasWeightSnapshot blk -> Point blk -> PerasWeight
78-
boostedWeightForPoint (PerasWeightSnapshot weightByPoint) pt =
78+
weightBoostOfPoint (PerasWeightSnapshot weightByPoint) pt =
7979
Map.findWithDefault mempty pt weightByPoint
8080

81-
boostedWeightForFragment ::
81+
weightBoostOfFragment ::
8282
forall blk h.
8383
(HasHeader blk, HasHeader h, HeaderHash blk ~ HeaderHash h) =>
8484
PerasWeightSnapshot blk ->
8585
AnchoredFragment h ->
8686
PerasWeight
87-
boostedWeightForFragment weightSnap frag =
87+
weightBoostOfFragment weightSnap frag =
8888
-- TODO think about whether this could be done in sublinear complexity
8989
foldMap
90-
(boostedWeightForPoint weightSnap)
91-
(castPoint . blockPoint <$> AF.toOldestFirst frag)
90+
(weightBoostOfPoint weightSnap . castPoint . blockPoint)
91+
(AF.toOldestFirst frag)

0 commit comments

Comments
 (0)