1010module Constrained.Bench where
1111
1212import Constrained.API
13+ import Constrained.Generation
14+ import Constrained.Examples.Set
15+ import Constrained.Examples.Map
16+
1317import Control.DeepSeq
1418import Criterion
1519import Data.Map (Map )
@@ -30,6 +34,9 @@ benchmarks =
3034 (giveHint (Nothing , 30 ) <> trueSpec :: Specification (Tree Int ))
3135 , benchSpec 10 30 " roseTreeMaybe" roseTreeMaybe
3236 , benchSpec 10 30 " listSumPair" listSumPair
37+ , benchSpec 10 30 " maybeJustSetSpec" maybeJustSetSpec
38+ , benchSpec 10 40 " eitherKeys" eitherKeys
39+ , benchSimplifySpec " eitherKeys" eitherKeys
3340 ]
3441
3542roseTreeMaybe :: Specification (Tree (Maybe (Int , Int )))
@@ -49,6 +56,11 @@ listSumPair = constrained $ \xs ->
4956 , forAll' xs $ \ x y -> [20 <. x, x <. 30 , y <. 100 ]
5057 ]
5158
59+ benchSimplifySpec :: HasSpec a => String -> Specification a -> Benchmark
60+ benchSimplifySpec nm spec =
61+ bench (" simplify/" ++ nm) $
62+ nf (show . simplifySpec) spec
63+
5264benchSpec :: (HasSpec a , NFData a ) => Int -> Int -> String -> Specification a -> Benchmark
5365benchSpec seed size nm spec =
5466 bench (unlines [nm, show (genFromSpecWithSeed seed size spec)]) $
0 commit comments