Skip to content

Commit 23a3656

Browse files
AndreasPKtreeowl
authored andcommitted
Group/Order set-operations-* benchmarks better.
Benchmarks are now run ordered by method/data_variant/data_size/swapped.
1 parent 0f61449 commit 23a3656

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benchmarks/SetOperations/SetOperations.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
module SetOperations (benchmark) where
55

66
import Gauge (bench, defaultMain, whnf)
7-
import Data.List (partition)
7+
import Data.List (partition, sortBy)
8+
import Data.Ord (comparing)
89
import Data.Tuple as Tuple
910

1011
-- | Benchmark a set operation for the given container.
@@ -19,10 +20,13 @@ benchmark fromList swap methods = do
1920
whnf (method input1) input2
2021

2122
| (method_str, method) <- methods
22-
, (input_str, data_sizes, (input1, input2)) <- base_inputs ++ swapped_input
23+
, (input_str, data_sizes, (input1, input2)) <- sortBenchs (base_inputs ++ swapped_input)
2324
]
2425

2526
where
27+
-- Sort benchmark inputs by (data variant, data sizes)
28+
sortBenchs = sortBy (comparing (\(name,size,_) -> (name,size)))
29+
2630
-- Data size descriptions, also used in the benchmark names.
2731
-- They are used to describe how large the input data is, but NOT the data itself.
2832
-- So for example nn_swap /= nn since the data size for both arguments is the same

0 commit comments

Comments
 (0)