diff --git a/.github/workflows/cabal-ci.yaml b/.github/workflows/cabal-ci.yaml index 402a00a..f3a5dbc 100644 --- a/.github/workflows/cabal-ci.yaml +++ b/.github/workflows/cabal-ci.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ['8.10', '9.0', '9.2', '9.4', '9.6'] + ghc: ['9.0', '9.2', '9.4', '9.6', '9.8'] cabal: ['3.10'] os: ['ubuntu-22.04', 'ubuntu-20.04', 'macOS-latest'] diff --git a/bench/Main.hs b/bench/Main.hs index c482f51..e878975 100644 --- a/bench/Main.hs +++ b/bench/Main.hs @@ -19,13 +19,13 @@ -- Maintainer: Lars Kuhtz -- Stability: experimental -- --- TODO --- module Main ( main ) where import Control.DeepSeq +import Control.Monad +import Control.Monad.Trans.State.Strict import Criterion import Criterion.Main @@ -35,16 +35,12 @@ import qualified "cryptonite" Crypto.Hash as CR import qualified Data.ByteArray as BA import qualified Data.ByteString as B -import Data.ByteString.Random.MWC import qualified Data.HashTree as HT import Data.Maybe import GHC.Generics -import Numeric.Natural - import System.Random -import qualified System.Random.MWC as MWC -- internal modules @@ -55,7 +51,7 @@ import qualified Data.MerkleLog as ML main :: IO () main = defaultMain - [ env globalEnv $ \ ~e -> bgroup "main" + [ env (return globalEnv) $ \ ~e -> bgroup "main" [ bgroup "create tree" [ bgroup "SHA512t_256" [ createBench @(ML SHA512t_256) e @@ -125,14 +121,12 @@ leafMaxSize = 1000 type GlobalEnv = [B.ByteString] -globalEnv :: IO GlobalEnv -globalEnv = do - gen <- MWC.create - traverse (randomGen gen) (randomNats leafCount) +globalEnv :: GlobalEnv +globalEnv = evalState (replicateM leafCount genBytes) (mkStdGen 1) where - -randomNats :: Int -> [Natural] -randomNats i = fmap fromIntegral $ take i $ randomRs @Int (0,leafMaxSize) $ mkStdGen 1 + genBytes = do + len <- state $ randomR (0, leafMaxSize) + state $ genByteString len -- -------------------------------------------------------------------------- -- -- Create Benchmark diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..5a9dee8 --- /dev/null +++ b/cabal.project @@ -0,0 +1,20 @@ +packages: merkle-log.cabal +optimization: 2 + +-- The following are all dependencies of GHC. +-- +allow-newer: *:Cabal +allow-newer: *:Cabal-syntax +allow-newer: *:array +allow-newer: *:base +allow-newer: *:bytestring +allow-newer: *:deepseq +allow-newer: *:ghc +allow-newer: *:ghc-boot-th +allow-newer: *:ghc-prim +allow-newer: *:integer-gmp +allow-newer: *:pretty +allow-newer: *:template-haskell +allow-newer: *:text + +constraints: aeson>2 diff --git a/merkle-log.cabal b/merkle-log.cabal index 0663e2c..1727790 100644 --- a/merkle-log.cabal +++ b/merkle-log.cabal @@ -12,11 +12,11 @@ maintainer: Lars Kuhtz copyright: Copyright (c) 2019-2023, Kadena LLC category: Data tested-with: + GHC==9.8 GHC==9.6 GHC==9.4 GHC==9.2 GHC==9.0 - GHC==8.10 extra-source-files: README.md CHANGELOG.md @@ -86,7 +86,6 @@ benchmark benchmarks , deepseq >=1.4 , hash-tree >=0.0 , memory >=0.14 - , mwc-random >=0.14 - , random >=1.1 - , random-bytestring >=0.1 + , random >=1.2 + , transformers >= 0.6