From c1d267b401589673bd1ce6787323e8cc8691a207 Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Wed, 9 Feb 2022 18:39:13 +0100 Subject: [PATCH 1/3] 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" From 61612d8f9561a6b796f4e3b82121021aa0e35114 Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Wed, 16 Feb 2022 16:49:44 +0100 Subject: [PATCH 2/3] remove bench.csv, add to .gitignore --- .gitignore | 3 +++ bench.csv | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 bench.csv diff --git a/.gitignore b/.gitignore index 5ae1889..0b2d9fe 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ TAGS # direnv files .envrc .direnv/ + +# Benchmark result csv file +bench.csv \ No newline at end of file diff --git a/bench.csv b/bench.csv deleted file mode 100644 index 343f8c0..0000000 --- a/bench.csv +++ /dev/null @@ -1,2 +0,0 @@ -name,cpu,mem,size -full_scripts:authorityTokenPolicy,1280339,4400,284 From ce55bb2a63f074d74a9dedec343011566b3cfaef Mon Sep 17 00:00:00 2001 From: Jack Hodgkinson <30505104+jhodgdev@users.noreply.github.com> Date: Wed, 16 Feb 2022 16:10:28 +0000 Subject: [PATCH 3/3] restored bench.csv --- .gitignore | 3 --- bench.csv | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 bench.csv diff --git a/.gitignore b/.gitignore index 0b2d9fe..5ae1889 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,3 @@ TAGS # direnv files .envrc .direnv/ - -# Benchmark result csv file -bench.csv \ No newline at end of file diff --git a/bench.csv b/bench.csv new file mode 100644 index 0000000..c4fe975 --- /dev/null +++ b/bench.csv @@ -0,0 +1,2 @@ +name,cpu,mem,size +full_scripts:authorityTokenPolicy,1280339,4400,284