Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed to ASTSize, changed to Maybe CoverageIndex #6081

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plutus-benchmark/marlowe/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ main = do
allTests =
testGroup "plutus-benchmark Marlowe tests"
[ runTestGhc ["semantics"] $
goldenSize "semantics" marloweValidator
goldenASTSize "semantics" marloweValidator
: [ goldenUEvalBudget name [value]
| bench <- semanticsMBench
, let (name, value) = mkBudgetTest marloweValidator bench
]
, runTestGhc ["role-payout"] $
goldenSize "role-payout" rolePayoutValidator
goldenASTSize "role-payout" rolePayoutValidator
: [ goldenUEvalBudget name [value]
| bench <- rolePayoutMBench
, let (name, value) = mkBudgetTest rolePayoutValidator bench
Expand Down
16 changes: 9 additions & 7 deletions plutus-benchmark/nofib/src/PlutusBenchmark/NoFib/Knights/Sort.hs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this because I was compiling with -O0 , and it complained that there was no unfolding for GHC.++ in quickSort. Turns out this module was using too much of ghc stdlib. Is it good that I changed it @kwxm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. The Haskell programs that these are based on are about 30 years old and are probably a bit old-fashioned to modern eyes: a lot of stuff that's commonly used these days just didn't exist when they were written. I just ported them with minimal changes and resisted the temptation to start "improving" them. My inclination would be to leave them as they are because changing the source makes it harder to see what changes are due to changes in our compiler: the differences in this file (which are quite small!) seem to have made the PIR for the whole program quite significantly different (current version, new version), which presumably accounts for the budget changes that show up later. Unless the programs stop working completely it's probably better not to change them.

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{-# OPTIONS_GHC -fno-warn-unused-top-binds #-}
{-# LANGUAGE NoImplicitPrelude #-}

module PlutusBenchmark.NoFib.Knights.Sort
( insertSort,
mergeSort,
quickSort
) where

import PlutusTx.Prelude qualified as Tx
import PlutusTx.Builtins as Tx
import PlutusTx.Prelude as Tx

{-# INLINABLE insertSort #-}
insertSort :: (Tx.Ord a) => [a] -> [a]
Expand All @@ -25,8 +27,8 @@ mergeSort xs
= if (n <=1 ) then xs
else
(mergeList
( mergeSort (take (n `div` 2) xs))
( mergeSort (drop (n `div` 2) xs)))
( mergeSort (take (n `divideInteger` 2) xs))
( mergeSort (drop (n `divideInteger` 2) xs)))
where
n = length xs

Expand Down Expand Up @@ -99,9 +101,9 @@ randomIntegers s1 s2 =
if 1 <= s2 && s2 <= 2147483398 then
rands s1 s2
else
error "randomIntegers: Bad second seed."
error () -- "randomIntegers: Bad second seed."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to use traceError "randomIntegers: Bad second seed."?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to use traceError "randomIntegers: Bad second seed."?

I think the reason for that is that traceError didn't exist when these were written (or more accurately, were stolen from here). I don't think that error will ever occur anyway.

else
error "randomIntegers: Bad first seed."
error () -- "randomIntegers: Bad first seed."

{-# INLINABLE rands #-}
rands :: Integer -> Integer -> [Integer]
Expand All @@ -110,11 +112,11 @@ rands s1 s2
else
z : rands s1'' s2''
where
k = s1 `div` 53668
k = s1 `divideInteger` 53668
s1' = 40014 * (s1 - k * 53668) - k * 12211
s1'' = if s1' < 0 then s1' + 2147483563 else s1'

k' = s2 `div` 52774
k' = s2 `divideInteger` 52774
s2' = 40692 * (s2 - k' * 52774) - k' * 3791
s2'' = if s2' < 0 then s2' + 2147483399 else s2'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1474894000
| mem: 7526812})
| mem: 7526812})
Loading