-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove random-bytestring dependency of benchmarks * remove support for GHC < 9
- Loading branch information
Showing
4 changed files
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,13 @@ | |
-- Maintainer: Lars Kuhtz <[email protected]> | ||
-- 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,11 @@ maintainer: Lars Kuhtz <[email protected]> | |
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 | ||
|