-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{- | Validation benchmarks for the CEK machine. -} | ||
{-# LANGUAGE BangPatterns #-} | ||
module Main where | ||
|
||
import Common | ||
import Control.Exception (evaluate) | ||
import Data.Proxy (Proxy (..)) | ||
import PlutusBenchmark.Common (toNamedDeBruijnTerm) | ||
import PlutusCore.Default (BuiltinSemanticsVariant (DefaultFunSemanticsVariantA)) | ||
import PlutusLedgerApi.Common (PlutusLedgerLanguage (PlutusV1)) | ||
import System.Directory (listDirectory) | ||
import Test.Tasty (askOption, defaultMainWithIngredients, includingOptions, testGroup) | ||
import Test.Tasty.Options (OptionDescription (..)) | ||
import Test.Tasty.PAPI (benchIngredients) | ||
import UntypedPlutusCore as UPLC | ||
|
||
{-| | ||
Benchmarks only for the CEK execution time of the data/*.flat validation scripts | ||
Run the benchmarks. You can run groups of benchmarks by typing things like | ||
`stack bench -- plutus-benchmark:validation --ba crowdfunding` | ||
or | ||
`cabal bench -- plutus-benchmark:validation --benchmark-options crowdfunding`. | ||
-} | ||
|
||
main :: IO () | ||
main = do | ||
scriptDirectory <- getScriptDirectory | ||
files <- listDirectory scriptDirectory | ||
evalCtx <- evaluate $ mkEvalCtx PlutusV1 DefaultFunSemanticsVariantA | ||
let customOpts = [Option (Proxy :: Proxy QuickFlag)] | ||
ingredients = includingOptions customOpts : benchIngredients | ||
|
||
mkCekBM file program = | ||
benchTermCek evalCtx . toNamedDeBruijnTerm . UPLC._progTerm $ unsafeUnflat file program | ||
benchmarks = askOption $ | ||
\(MkQuickFlag isQuick) -> testGroup "All" $ | ||
mkBMs mkCekBM scriptDirectory (prepareFilePaths isQuick files) | ||
defaultMainWithIngredients ingredients benchmarks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters