From c1d267b401589673bd1ce6787323e8cc8691a207 Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Wed, 9 Feb 2022 18:39:13 +0100 Subject: [PATCH] add benchmarking stub using plutus-benchmark --- agora.cabal | 9 +++++++++ bench.csv | 2 ++ bench/Main.hs | 25 +++++++++++++++++++++++++ flake.nix | 9 +++++++-- hie.yaml | 4 ++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 bench.csv create mode 100644 bench/Main.hs diff --git a/agora.cabal b/agora.cabal index bc8e01d..eead6e9 100644 --- a/agora.cabal +++ b/agora.cabal @@ -101,3 +101,12 @@ test-suite agora-test type: exitcode-stdio-1.0 main-is: Spec.hs hs-source-dirs: test + +benchmark agora-bench + import: lang, deps + hs-source-dirs: bench + main-is: Main.hs + type: exitcode-stdio-1.0 + build-depends: + , plutarch-benchmark + , agora \ No newline at end of file diff --git a/bench.csv b/bench.csv new file mode 100644 index 0000000..152f602 --- /dev/null +++ b/bench.csv @@ -0,0 +1,2 @@ +name,cpu,mem,size +full scripts:authorityTokenPolicy,1399431,4800,363 diff --git a/bench/Main.hs b/bench/Main.hs new file mode 100644 index 0000000..ec50558 --- /dev/null +++ b/bench/Main.hs @@ -0,0 +1,25 @@ +module Main (main) where + +import Prelude + +-------------------------------------------------------------------------------- + +import Plutarch.Benchmark +import Plutus.V1.Ledger.Value qualified as Value + +-------------------------------------------------------------------------------- + +import Agora.AuthorityToken qualified as Agora + +-------------------------------------------------------------------------------- + +main :: IO () +main = do + benchMain benchmarks + +benchmarks :: [NamedBenchmark] +benchmarks = + benchGroup + "full_scripts" + [ bench "authorityTokenPolicy" $ Agora.authorityTokenPolicy (Agora.AuthorityToken (Value.assetClass "" "")) + ] diff --git a/flake.nix b/flake.nix index 6b9f7a5..65bbf33 100644 --- a/flake.nix +++ b/flake.nix @@ -192,7 +192,7 @@ } { src = inputs.plutarch; - subdirs = [ "." ]; + subdirs = [ "." "plutarch-benchmark" ]; } { src = inputs.cardano-addresses; @@ -321,7 +321,12 @@ graphviz ]; - additional = ps: [ ps.plutarch ps.plutus-ledger ps.plutus-extra ]; + additional = ps: [ + ps.plutarch + ps.plutarch-benchmark + ps.plutus-ledger + ps.plutus-extra + ]; tools.haskell-language-server = { }; }; diff --git a/hie.yaml b/hie.yaml index 2a1e864..bea0b14 100644 --- a/hie.yaml +++ b/hie.yaml @@ -2,3 +2,7 @@ cradle: cabal: - path: "./src" component: "lib:agora" + - path: "./bench" + component: "benchmark:agora-bench" + - path: "./test" + component: "test:agora-test"