Skip to content

Commit e32ed83

Browse files
Update benchmarks
1 parent 56c4f64 commit e32ed83

File tree

3 files changed

+72
-36
lines changed

3 files changed

+72
-36
lines changed

benchmark/Benchmark/Free.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Benchmark.Free (module Control.Monad.Free) where
2+
3+
import Control.Monad.Free

benchmark/Benchmark/Main.purs

Lines changed: 66 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ module Benchmark.Main (main) where
22

33
import Prelude
44

5+
import Benchmark.Free as Free
56
import Benchmark.Freef686f5f as Freef686f5f
7+
import Benchmark.Trampoline as Trampoline
68
import Benchmark.Trampoline0df59c5 as Trampoline0df59c5
79
import Benchmark.Trampolinef686f5f as Trampolinef686f5f
810
import Benchotron.Core (Benchmark, benchFn, mkBenchmark)
@@ -30,25 +32,32 @@ leftBindSmallBenchmark =
3032
, inputsPerSize: inputsPerSize
3133
, gen: \n -> vectorOf n (pure 0.0)
3234
, functions:
33-
[ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds)
34-
, benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT)
35+
[ benchFn "Free (master)" (Trampoline.runTrampoline <<< binds)
36+
, benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds_5_2_0)
37+
, benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< binds_0_6_1)
3538
]
3639
}
3740
where
3841
inputsPerSize :: Int
3942
inputsPerSize = 100
4043

41-
binds :: Array Number -> Trampolinef686f5f.Trampoline Number
44+
binds :: Array Number -> Trampoline.Trampoline Number
4245
binds as = foldl (\b a -> b >>= const (gen a)) (gen 0.0) as
4346

44-
gen :: forall a. a -> Trampolinef686f5f.Trampoline a
45-
gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done
47+
gen :: forall a. a -> Trampoline.Trampoline a
48+
gen = Free.suspend <<< Trampoline.done
4649

47-
bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number
48-
bindsT as = foldl (\b a -> b >>= const (genT a)) (genT 0.0) as
50+
binds_5_2_0 :: Array Number -> Trampolinef686f5f.Trampoline Number
51+
binds_5_2_0 as = foldl (\b a -> b >>= const (gen_5_2_0 a)) (gen_5_2_0 0.0) as
4952

50-
genT :: forall a. a -> Trampoline0df59c5.Trampoline a
51-
genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
53+
gen_5_2_0 :: forall a. a -> Trampolinef686f5f.Trampoline a
54+
gen_5_2_0 = Freef686f5f.suspendF <<< Trampolinef686f5f.done
55+
56+
binds_0_6_1 :: Array Number -> Trampoline0df59c5.Trampoline Number
57+
binds_0_6_1 as = foldl (\b a -> b >>= const (gen_0_6_1 a)) (gen_0_6_1 0.0) as
58+
59+
gen_0_6_1 :: forall a. a -> Trampoline0df59c5.Trampoline a
60+
gen_0_6_1 = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
5261

5362
rightBindSmallBenchmark :: Benchmark
5463
rightBindSmallBenchmark =
@@ -60,25 +69,32 @@ rightBindSmallBenchmark =
6069
, inputsPerSize: inputsPerSize
6170
, gen: \n -> vectorOf n (pure 0.0)
6271
, functions:
63-
[ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds)
64-
, benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT)
72+
[ benchFn "Free (master)" (Trampoline.runTrampoline <<< binds)
73+
, benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds_5_2_0)
74+
, benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< binds_0_6_1)
6575
]
6676
}
6777
where
6878
inputsPerSize :: Int
6979
inputsPerSize = 100
7080

71-
binds :: Array Number -> Trampolinef686f5f.Trampoline Number
81+
binds :: Array Number -> Trampoline.Trampoline Number
7282
binds as = foldl (\b a -> gen a >>= const b) (gen 0.0) as
7383

74-
gen :: forall a. a -> Trampolinef686f5f.Trampoline a
75-
gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done
84+
gen :: forall a. a -> Trampoline.Trampoline a
85+
gen = Free.suspend <<< Trampoline.done
86+
87+
binds_5_2_0 :: Array Number -> Trampolinef686f5f.Trampoline Number
88+
binds_5_2_0 as = foldl (\b a -> gen_5_2_0 a >>= const b) (gen_5_2_0 0.0) as
89+
90+
gen_5_2_0 :: forall a. a -> Trampolinef686f5f.Trampoline a
91+
gen_5_2_0 = Freef686f5f.suspendF <<< Trampolinef686f5f.done
7692

77-
bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number
78-
bindsT as = foldl (\b a -> genT a >>= const b) (genT 0.0) as
93+
binds_0_6_1 :: Array Number -> Trampoline0df59c5.Trampoline Number
94+
binds_0_6_1 as = foldl (\b a -> gen_0_6_1 a >>= const b) (gen_0_6_1 0.0) as
7995

80-
genT :: forall a. a -> Trampoline0df59c5.Trampoline a
81-
genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
96+
gen_0_6_1 :: forall a. a -> Trampoline0df59c5.Trampoline a
97+
gen_0_6_1 = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
8298

8399
leftBindLargeBenchmark :: Benchmark
84100
leftBindLargeBenchmark =
@@ -90,26 +106,33 @@ leftBindLargeBenchmark =
90106
, inputsPerSize: inputsPerSize
91107
, gen: \n -> vectorOf n (pure 0.0)
92108
, functions:
93-
[ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds)
109+
[ benchFn "Free (master)" (Trampoline.runTrampoline <<< binds)
110+
, benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds_5_2_0)
94111
-- Disabled due to stack overflow
95-
-- , benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT)
112+
-- , benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< binds_0_6_1)
96113
]
97114
}
98115
where
99116
inputsPerSize :: Int
100117
inputsPerSize = 1
101118

102-
binds :: Array Number -> Trampolinef686f5f.Trampoline Number
119+
binds :: Array Number -> Trampoline.Trampoline Number
103120
binds as = foldl (\b a -> b >>= const (gen a)) (gen 0.0) as
104121

105-
gen :: forall a. a -> Trampolinef686f5f.Trampoline a
106-
gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done
122+
gen :: forall a. a -> Trampoline.Trampoline a
123+
gen = Free.suspend <<< Trampoline.done
107124

108-
bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number
109-
bindsT as = foldl (\b a -> b >>= const (genT a)) (genT 0.0) as
125+
binds_5_2_0 :: Array Number -> Trampolinef686f5f.Trampoline Number
126+
binds_5_2_0 as = foldl (\b a -> b >>= const (gen_5_2_0 a)) (gen_5_2_0 0.0) as
110127

111-
genT :: forall a. a -> Trampoline0df59c5.Trampoline a
112-
genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
128+
gen_5_2_0 :: forall a. a -> Trampolinef686f5f.Trampoline a
129+
gen_5_2_0 = Freef686f5f.suspendF <<< Trampolinef686f5f.done
130+
131+
binds_0_6_1 :: Array Number -> Trampoline0df59c5.Trampoline Number
132+
binds_0_6_1 as = foldl (\b a -> b >>= const (gen_0_6_1 a)) (gen_0_6_1 0.0) as
133+
134+
gen_0_6_1 :: forall a. a -> Trampoline0df59c5.Trampoline a
135+
gen_0_6_1 = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
113136

114137
rightBindLargeBenchmark :: Benchmark
115138
rightBindLargeBenchmark =
@@ -121,22 +144,29 @@ rightBindLargeBenchmark =
121144
, inputsPerSize: inputsPerSize
122145
, gen: \n -> vectorOf n (pure 0.0)
123146
, functions:
124-
[ benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds)
125-
, benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< bindsT)
147+
[ benchFn "Free (master)" (Trampoline.runTrampoline <<< binds)
148+
, benchFn "Free v5.2.0" (Trampolinef686f5f.runTrampoline <<< binds_5_2_0)
149+
, benchFn "Free v0.6.1" (Trampoline0df59c5.runTrampoline <<< binds_0_6_1)
126150
]
127151
}
128152
where
129153
inputsPerSize :: Int
130154
inputsPerSize = 1
131155

132-
binds :: Array Number -> Trampolinef686f5f.Trampoline Number
156+
binds :: Array Number -> Trampoline.Trampoline Number
133157
binds as = foldl (\b a -> gen a >>= const b) (gen 0.0) as
134158

135-
gen :: forall a. a -> Trampolinef686f5f.Trampoline a
136-
gen = Freef686f5f.suspendF <<< Trampolinef686f5f.done
159+
gen :: forall a. a -> Trampoline.Trampoline a
160+
gen = Free.suspend <<< Trampoline.done
161+
162+
binds_5_2_0 :: Array Number -> Trampolinef686f5f.Trampoline Number
163+
binds_5_2_0 as = foldl (\b a -> gen_5_2_0 a >>= const b) (gen_5_2_0 0.0) as
164+
165+
gen_5_2_0 :: forall a. a -> Trampolinef686f5f.Trampoline a
166+
gen_5_2_0 = Freef686f5f.suspendF <<< Trampolinef686f5f.done
137167

138-
bindsT :: Array Number -> Trampoline0df59c5.Trampoline Number
139-
bindsT as = foldl (\b a -> genT a >>= const b) (genT 0.0) as
168+
binds_0_6_1 :: Array Number -> Trampoline0df59c5.Trampoline Number
169+
binds_0_6_1 as = foldl (\b a -> gen_0_6_1 a >>= const b) (gen_0_6_1 0.0) as
140170

141-
genT :: forall a. a -> Trampoline0df59c5.Trampoline a
142-
genT = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done
171+
gen_0_6_1 :: forall a. a -> Trampoline0df59c5.Trampoline a
172+
gen_0_6_1 = Trampoline0df59c5.suspend <<< Trampoline0df59c5.done

benchmark/Benchmark/Trampoline.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Benchmark.Trampoline (module Control.Monad.Trampoline) where
2+
3+
import Control.Monad.Trampoline

0 commit comments

Comments
 (0)