Skip to content

Commit

Permalink
Updated 'plutus-core' benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
effectfully committed Sep 21, 2020
1 parent 4d92d6a commit 5e5bd3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions plutus-core/bench/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sig = "e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb882159
pubKey = "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a"
msg = ""

traceBuiltins :: QuoteT (Either (Error DefaultUni ())) (DynamicBuiltinNameTypes DefaultUni)
traceBuiltins :: QuoteT (Either (Error DefaultUni () ())) (DynamicBuiltinNameTypes DefaultUni)
traceBuiltins = getStringBuiltinTypes ()

main :: IO ()
Expand All @@ -46,7 +46,7 @@ main =
]

, env sampleScript $ \ f ->
let typeCheckConcrete :: Program TyName Name DefaultUni () -> Either (Error DefaultUni ()) (Normalized (Type TyName DefaultUni ()))
let typeCheckConcrete :: Program TyName Name DefaultUni () () -> Either (Error DefaultUni () ()) (Normalized (Type TyName DefaultUni ()))
typeCheckConcrete p = runQuoteT $ do
bis <- traceBuiltins
inferTypeOfProgram (defConfig { _tccDynamicBuiltinNameTypes = bis }) p
Expand All @@ -56,23 +56,23 @@ main =
bgroup "type-check" $ mkBench <$> [f]

, env largeTypeFiles $ \ ~(f, g, h) ->
let typeCheckConcrete :: Program TyName Name DefaultUni AlexPosn -> Either (Error DefaultUni AlexPosn) (Normalized (Type TyName DefaultUni ()))
let typeCheckConcrete :: Program TyName Name DefaultUni () AlexPosn -> Either (Error DefaultUni () AlexPosn) (Normalized (Type TyName DefaultUni ()))
typeCheckConcrete = runQuoteT . inferTypeOfProgram defConfig
mkBench = bench "type-check" . nf (typeCheckConcrete =<<) . runQuoteT . parseScoped
in

bgroup "type-check" $ mkBench <$> [f, g, h]

, env sampleScript $ \ f ->
let renameConcrete :: Program TyName Name DefaultUni () -> Program TyName Name DefaultUni ()
let renameConcrete :: Program TyName Name DefaultUni () () -> Program TyName Name DefaultUni () ()
renameConcrete = runQuote . rename
mkBench = bench "rename (Plutus Tx)" . nf renameConcrete . deserialise
in

bgroup "renamer" $ mkBench <$> [f]

, env largeTypeFiles $ \ ~(f, g, h) ->
let renameConcrete :: Program TyName Name DefaultUni AlexPosn -> Program TyName Name DefaultUni AlexPosn
let renameConcrete :: Program TyName Name DefaultUni () AlexPosn -> Program TyName Name DefaultUni () AlexPosn
renameConcrete = runQuote . rename
mkBench = bench "rename" . nf (fmap renameConcrete) . parse
in
Expand All @@ -86,7 +86,7 @@ main =
bgroup "CBOR" $ mkBench <$> [f, g, h]

, env largeTypeFiles $ \ ~(f, g, h) ->
let deserialiseProgram :: BSL.ByteString -> Program TyName Name DefaultUni ()
let deserialiseProgram :: BSL.ByteString -> Program TyName Name DefaultUni () ()
deserialiseProgram = deserialise
parseAndSerialise :: BSL.ByteString -> Either (ParseError AlexPosn) BSL.ByteString
parseAndSerialise = fmap (serialise . void) . parse
Expand All @@ -96,7 +96,7 @@ main =
bgroup "CBOR" $ mkBench <$> [f, g, h]

, env evalFiles $ \ ~(f, g) ->
let processor :: BSL.ByteString -> Either (Error DefaultUni AlexPosn) (Program TyName Name DefaultUni ())
let processor :: BSL.ByteString -> Either (Error DefaultUni () AlexPosn) (Program TyName Name DefaultUni () ())
processor contents = void <$> (runQuoteT $ parseScoped contents)
f' = processor f
g' = processor g
Expand All @@ -107,7 +107,7 @@ main =
, bench "invalid" $ nf (fmap $ unsafeEvaluateCk mempty . toTerm) g'
]
, env evalFiles $ \ ~(f, g) ->
let processor :: BSL.ByteString -> Either (Error DefaultUni AlexPosn) (Program TyName Name DefaultUni ())
let processor :: BSL.ByteString -> Either (Error DefaultUni () AlexPosn) (Program TyName Name DefaultUni () ())
processor contents = void <$> (runQuoteT $ parseScoped contents)
f' = processor f
g' = processor g
Expand Down
2 changes: 1 addition & 1 deletion plutus-core/budgeting-bench/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Criterion.Main
import qualified Criterion.Types as C
import Data.Functor

runTermBench :: String -> Plain Term DefaultUni -> Benchmark
runTermBench :: String -> Plain Term DefaultUni () -> Benchmark
runTermBench name term = env
(do
(_result, budget) <-
Expand Down
2 changes: 1 addition & 1 deletion plutus-core/weigh/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Weigh
main :: IO ()
main = do
~(f, g) <- evalFiles
let processor :: BSL.ByteString -> Either (Error DefaultUni AlexPosn) (Term TyName Name DefaultUni ())
let processor :: BSL.ByteString -> Either (Error DefaultUni () AlexPosn) (Term TyName Name DefaultUni () ())
processor contents = toTerm . void <$> runQuoteT (parseScoped contents)
f' = processor f
g' = processor g
Expand Down

0 comments on commit 5e5bd3d

Please sign in to comment.