on master help sign in
Change and document the behaviour of --diff-cutoff-percent
7a0fcceAdithya Kumar
benchmark/bench-report/BenchReport.hs+12−14
@@ -209,25 +209,23 @@ selectBench
209 -> (SortColumn -> Maybe GroupStyle -> Either String [(String, Double)])
209 -> (SortColumn -> Maybe GroupStyle -> Either String [(String, Double)])
210 -> [String]
210 -> [String]
211selectBench Options{..} f =
211selectBench Options{..} f =
212− reverse
212+ -- Apply filterPred only if at least 2 columns exist
213− $ fmap fst
213+ let colVals =
214− $ filter (\(_,y) -> filterPred y)
214+ case f (ColumnIndex 1) (Just PercentDiff) of
215− $ either
216− (const $ either error sortFunc $ f (ColumnIndex 0) (Just PercentDiff))
215+ Left _ -> either error id $ f (ColumnIndex 0) (Just PercentDiff)
217− sortFunc
216+ Right xs -> filter (filterPred . snd) xs
218− $ f (ColumnIndex 1) (Just PercentDiff)
217+ in reverse
218+ $ fmap fst
219+ $ sortFunc colVals
219
220
220 where
221 where
221
222
222 sortFunc = if sortByName then sortOn fst else sortOn snd
223 sortFunc = if sortByName then sortOn fst else sortOn snd
223
224
224− cutOffMultiples = 1 + cutOffPercent / 100
225−
226− filterPred x =
225+ filterPred x
227− case benchType of
226+ | cutOffPercent > 0 = x >= cutOffPercent
228− Just (Compare _) ->
229− x <= negate cutOffPercent || x >= cutOffPercent
227+ | cutOffPercent < 0 = x <= cutOffPercent
230− _ -> True
228+ | otherwise = True
231
229
232benchShow ::
230benchShow ::
233 Options
231 Options
benchmark/bench-report/bin/bench-runner.sh+8−1
@@ -21,7 +21,7 @@ print_help () {
21 echo " [--sort-by-name]"
21 echo " [--sort-by-name]"
22 echo " [--compare]"
22 echo " [--compare]"
23 echo " [--diff-style <absolute|percent|multiples>]"
23 echo " [--diff-style <absolute|percent|multiples>]"
24− echo " [--cutoff-percent <percent-value>]"
24+ echo " [--diff-cutoff-percent <percent-value>]"
25 echo " [--graphs]"
25 echo " [--graphs]"
26 echo " [--silent]"
26 echo " [--silent]"
27 echo " [--no-measure]"
27 echo " [--no-measure]"
@@ -40,6 +40,13 @@ print_help () {
40 echo
40 echo
41 echo "--benchmarks: benchmarks to run, use 'help' for list of benchmarks"
41 echo "--benchmarks: benchmarks to run, use 'help' for list of benchmarks"
42 echo "--compare: compare the specified benchmarks with each other"
42 echo "--compare: compare the specified benchmarks with each other"
43+
44+ echo "--diff-cutoff-percent: Diff percentage used for benchmark selection."
45+ echo "This applies only to the second column of the report and makes sense"
46+ echo "only while comparing benchmarks."
47+ echo "A positive cutoff value selects only regressions, whereas, a negative"
48+ echo "cutoff value selects only improvements."
49+
43 echo "--fields: measurement fields to report, use 'help' for a list"
50 echo "--fields: measurement fields to report, use 'help' for a list"
44 echo "--graphs: Generate graphical reports"
51 echo "--graphs: Generate graphical reports"
45 echo "--no-measure: Don't run benchmarks, run reports from previous results"
52 echo "--no-measure: Don't run benchmarks, run reports from previous results"