on master help sign in
Drop rng-utils in test
b04d008Michael Xavier
katip-elasticsearch/bench/Main.hs+9−12
@@ -13,7 +13,7 @@ import Criterion.Main
13import Data.Aeson
13import Data.Aeson
14import qualified Data.HashMap.Strict as HM
14import qualified Data.HashMap.Strict as HM
15import Data.Proxy (Proxy (..))
15import Data.Proxy (Proxy (..))
16−import Data.RNG
16+import System.Random
17import qualified Data.Text as T
17import qualified Data.Text as T
18import Database.V1.Bloodhound.Types
18import Database.V1.Bloodhound.Types
19import Numeric
19import Numeric
@@ -24,19 +24,18 @@ import Katip.Scribes.ElasticSearch.Internal (ESV1)
24
24
25main :: IO ()
25main :: IO ()
26main = do
26main = do
27− rng <- mkRNG
28 defaultMain
27 defaultMain
29 [
28 [
30− mkDocIdBenchmark rng
29+ mkDocIdBenchmark
31 , deannotateValueBenchmark
30 , deannotateValueBenchmark
32 ]
31 ]
33
32
34-------------------------------------------------------------------------------
33-------------------------------------------------------------------------------
35−mkDocIdBenchmark :: RNG -> Benchmark
34+mkDocIdBenchmark :: Benchmark
36−mkDocIdBenchmark rng = bgroup "mkDocId"
35+mkDocIdBenchmark = bgroup "mkDocId"
37 [
36 [
38 bench "mkDocId (randomIO)" $ nfIO (mkDocId (Proxy :: Proxy ESV1))
37 bench "mkDocId (randomIO)" $ nfIO (mkDocId (Proxy :: Proxy ESV1))
39− , bench "mkDocId' (shared )" $ nfIO $ mkDocId' rng
38+ , bench "mkDocId' (shared )" $ nfIO mkDocId'
40 ]
39 ]
41
40
42
41
@@ -58,13 +57,11 @@ annotatedValue = Object $ HM.fromList [ ("a::string", String "whatever")
58 ]
57 ]
59
58
60-------------------------------------------------------------------------------
59-------------------------------------------------------------------------------
61−mkDocId' :: RNG -> IO DocId
60+mkDocId' :: IO DocId
62−mkDocId' rng = do
61+mkDocId' = do
63− is <- withRNG rng $ \gen -> replicateM len $ mk gen
62+ is <- replicateM len (randomRIO (0, 15))
64− return . DocId . T.pack . concatMap (`showHex` "") $ is
63+ return (DocId (T.pack (concatMap (`showHex` "") (is :: [Int]))))
65 where
64 where
66 len = 32
65 len = 32
67− mk :: GenIO -> IO Int
68− mk = uniformR (0,15)
69
66
70deriving instance NFData DocId
67deriving instance NFData DocId
katip-elasticsearch/katip-elasticsearch.cabal+1−1
@@ -72,7 +72,7 @@ benchmark bench
72 , bloodhound
72 , bloodhound
73 , deepseq
73 , deepseq
74 , criterion >= 1.1.0.0
74 , criterion >= 1.1.0.0
75− , rng-utils
75+ , random
76 , uuid
76 , uuid
77 , text
77 , text
78 , unordered-containers
78 , unordered-containers
stack-lts-2.yaml−1
@@ -19,7 +19,6 @@ extra-deps:
19 - microlens-th-0.4.1.0
19 - microlens-th-0.4.1.0
20 - time-1.5.0.1
20 - time-1.5.0.1
21 - memory-0.13
21 - memory-0.13
22− - rng-utils-0.2.1
23 - lens-aeson-1.0.0.5
22 - lens-aeson-1.0.0.5
24 - atomic-primops-0.8.0.4
23 - atomic-primops-0.8.0.4
25 - safe-exceptions-0.1.5.0
24 - safe-exceptions-0.1.5.0
stack-lts-3.yaml−1
@@ -13,7 +13,6 @@ extra-deps:
13 - attoparsec-0.13.1.0
13 - attoparsec-0.13.1.0
14 - retry-0.7.4.2
14 - retry-0.7.4.2
15 - tasty-0.11.0.4
15 - tasty-0.11.0.4
16− - rng-utils-0.2.1
17 - safe-exceptions-0.1.5.0
16 - safe-exceptions-0.1.5.0
18flags:
17flags:
19 katip:
18 katip:
stack-lts-4.yaml−1
@@ -10,7 +10,6 @@ extra-deps:
10 - fail-4.9.0.0
10 - fail-4.9.0.0
11 - tagged-0.8.3
11 - tagged-0.8.3
12 - uuid-1.3.12
12 - uuid-1.3.12
13− - rng-utils-0.2.1
14 - safe-exceptions-0.1.5.0
13 - safe-exceptions-0.1.5.0
15flags:
14flags:
16 katip:
15 katip:
stack-lts-5.yaml−1
@@ -7,7 +7,6 @@ extra-deps:
7 - string-conv-0.1.2
7 - string-conv-0.1.2
8 - aeson-0.11.1.0
8 - aeson-0.11.1.0
9 - http-client-0.5.4
9 - http-client-0.5.4
10− - rng-utils-0.2.1
11 - safe-exceptions-0.1.5.0
10 - safe-exceptions-0.1.5.0
12flags:
11flags:
13 katip:
12 katip: