on master help sign in
Change and document the behaviour of --diff-cutoff-percent
commit7a0fcce4cf1f4d475f09f320d56fa4580795a427 authorAdithya Kumar <adithya@composewell.com> dateThu 27 Jan 2022, 04:14 (5 years ago) parent27397f3
2 files changed+20−15
benchmark/bench-report/BenchReport.hs+12−14 benchmark/bench-report/bin/bench-runner.sh+8−1
benchmark/bench-report/BenchReport.hs+12−14
@@ -209,25 +209,23 @@ selectBench
209209 -> (SortColumn -> Maybe GroupStyle -> Either String [(String, Double)])
210210 -> [String]
211211selectBench Options{..} f =
212− reverse
213− $ fmap fst
214− $ filter (\(_,y) -> filterPred y)
215− $ either
216− (const $ either error sortFunc $ f (ColumnIndex 0) (Just PercentDiff))
217− sortFunc
218− $ f (ColumnIndex 1) (Just PercentDiff)
212+ -- Apply filterPred only if at least 2 columns exist
213+ let colVals =
214+ case f (ColumnIndex 1) (Just PercentDiff) of
215+ Left _ -> either error id $ f (ColumnIndex 0) (Just PercentDiff)
216+ Right xs -> filter (filterPred . snd) xs
217+ in reverse
218+ $ fmap fst
219+ $ sortFunc colVals
219220
220221 where
221222
222223 sortFunc = if sortByName then sortOn fst else sortOn snd
223224
224− cutOffMultiples = 1 + cutOffPercent / 100
225−
226− filterPred x =
227− case benchType of
228− Just (Compare _) ->
229− x <= negate cutOffPercent || x >= cutOffPercent
230− _ -> True
225+ filterPred x
226+ | cutOffPercent > 0 = x >= cutOffPercent
227+ | cutOffPercent < 0 = x <= cutOffPercent
228+ | otherwise = True
231229
232230benchShow ::
233231 Options
benchmark/bench-report/bin/bench-runner.sh+8−1
@@ -21,7 +21,7 @@ print_help () {
2121 echo " [--sort-by-name]"
2222 echo " [--compare]"
2323 echo " [--diff-style <absolute|percent|multiples>]"
24− echo " [--cutoff-percent <percent-value>]"
24+ echo " [--diff-cutoff-percent <percent-value>]"
2525 echo " [--graphs]"
2626 echo " [--silent]"
2727 echo " [--no-measure]"
@@ -40,6 +40,13 @@ print_help () {
4040 echo
4141 echo "--benchmarks: benchmarks to run, use 'help' for list of benchmarks"
4242 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+
4350 echo "--fields: measurement fields to report, use 'help' for a list"
4451 echo "--graphs: Generate graphical reports"
4552 echo "--no-measure: Don't run benchmarks, run reports from previous results"