From caad2cc445f63c642d44d637b72e73a95979bd06 Mon Sep 17 00:00:00 2001 From: Kenneth MacKenzie Date: Fri, 26 Jul 2024 06:37:00 +0100 Subject: [PATCH] Kwxm/bitwise/enable nqueens benchmark (#6343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables the bitwise `nqueens` benchmark following the fix for `writeBits` in Plinth in #6309. ``` $ cabal bench bitwise-bench Build profile: -w ghc-9.6.6 -O1 In order, the following will be built (use -v for more details): - plutus-benchmark-0.1.0.0 (bench:bitwise-bench) (first run) Preprocessing benchmark 'bitwise-bench' for plutus-benchmark-0.1.0.0... Building benchmark 'bitwise-bench' for plutus-benchmark-0.1.0.0... Running 1 benchmarks... Benchmark bitwise-bench: RUNNING... benchmarking 8-queens time 683.4 ms (681.5 ms .. 685.0 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 678.6 ms (674.1 ms .. 680.4 ms) std dev 3.211 ms (92.63 μs .. 3.978 ms) variance introduced by outliers: 19% (moderately inflated) Benchmark bitwise-bench: FINISH ``` --- plutus-benchmark/bitwise/bench/Main.hs | 14 +++++--------- plutus-benchmark/plutus-benchmark.cabal | 14 +++++++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plutus-benchmark/bitwise/bench/Main.hs b/plutus-benchmark/bitwise/bench/Main.hs index 110b460cb2e..8841ffac3ce 100644 --- a/plutus-benchmark/bitwise/bench/Main.hs +++ b/plutus-benchmark/bitwise/bench/Main.hs @@ -1,17 +1,14 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TemplateHaskell #-} + module Main (main) where -{- import Criterion.Main (bench, defaultMain) import PlutusBenchmark.Common (benchProgramCek, mkMostRecentEvalCtx) import PlutusBenchmark.NQueens (nqueens) import PlutusTx.Code (CompiledCode, getPlcNoAnn) +import PlutusTx.Plugin () import PlutusTx.TH (compile) --} - -main :: IO () -main = print "Pending" - -{- Currently not able to run, due to problems with writeBits compiling under PlutusTx main :: IO () main = defaultMain [ @@ -21,6 +18,5 @@ main = defaultMain [ -- Helpers nqueensCompiled :: CompiledCode [(Integer, Integer)] -nqueensCompiled = $$(compile [||nqueens 8||]) +nqueensCompiled = $$(compile [|| nqueens 8 ||]) --} diff --git a/plutus-benchmark/plutus-benchmark.cabal b/plutus-benchmark/plutus-benchmark.cabal index 28fd92ad75f..ebf9dfa8c8f 100644 --- a/plutus-benchmark/plutus-benchmark.cabal +++ b/plutus-benchmark/plutus-benchmark.cabal @@ -618,10 +618,10 @@ benchmark bitwise-bench type: exitcode-stdio-1.0 main-is: Main.hs hs-source-dirs: bitwise/bench - build-depends: base >=4.9 && <5 - --- , bitwise-internal --- , criterion --- , plutus-benchmark-common --- , plutus-tx ^>=1.30 --- , plutus-tx-plugin ^>=1.30 + build-depends: + , base >=4.9 && <5 + , bitwise-internal + , criterion + , plutus-benchmark-common + , plutus-tx ^>=1.31 + , plutus-tx-plugin ^>=1.31