Skip to content

Commit 8e5f83e

Browse files
authored
Merge pull request #14 from WillAbides/konggroups
update kong and get rid of internal helpprinter
2 parents 0f71481 + 14b5cfe commit 8e5f83e

File tree

9 files changed

+59
-627
lines changed

9 files changed

+59
-627
lines changed

README.md

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ It essentially combines multiple `git`, `go test -bench` and `benchstat` command
1414

1515
These are the basic steps `benchdiff` performs:
1616
- Runs `go test -bench ...` on your current worktree and saves the results to a cache directory.
17-
- Creates a git stash with the current state of your worktree
18-
- Switches to the base ref (usually "HEAD" or "master").
19-
- Runs `go test -bench ...` and saves the results to cache again.
20-
- Switches back to the original git HEAD and restores the state from stash
17+
- Creates a new worktree at the base ref
18+
- Runs `go test -bench ...` on the base worktree and saves the results to cache again.
2119
- Runs `benchstat` to compare the base and head results from cache.
2220

2321
## GitHub Action
@@ -42,51 +40,51 @@ Flags:
4240
--version Output the benchdiff version and exit.
4341
--debug write verbose output to stderr
4442
45-
--base-ref="HEAD" The git ref to be used as a baseline.
46-
--cooldown=100ms How long to pause for cooldown between head and base runs.
47-
--force-base Rerun benchmarks on the base reference even if the output already exists.
48-
--git-cmd="git" The executable to use for git commands.
49-
--json Format output as JSON.
50-
--on-degrade=0 Exit code when there is a statistically significant degradation in the
51-
results.
52-
--tolerance=10.0 The minimum percent change before a result is considered degraded.
53-
54-
benchmark command line:
55-
--bench="." Run only those benchmarks matching a regular expression. To run all
56-
benchmarks, use '--bench .'.
57-
--benchmark-args=args Override the default args to the go command. This may be a template.
58-
See https://github.com/willabides/benchdiff for details."
59-
--benchmark-cmd="go" The command to use for benchmarks.
60-
--benchmem Memory allocation statistics for benchmarks.
61-
--benchtime=STRING Run enough iterations of each benchmark to take t, specified as a
62-
time.Duration (for example, --benchtime 1h30s). The default is 1
63-
second (1s). The special syntax Nx means to run the benchmark N times
64-
(for example, -benchtime 100x).
65-
--count=10 Run each benchmark n times. If --cpu is set, run n times for each
66-
GOMAXPROCS value.'
67-
--cpu=GOMAXPROCS,... Specify a list of GOMAXPROCS values for which the benchmarks should
68-
be executed. The default is the current value of GOMAXPROCS.
69-
--packages="./..." Run benchmarks in these packages.
70-
--show-bench-cmdline Instead of running benchmarks, output the command that would be used
71-
and exit.
72-
--tags=STRING Set the -tags flag on the go test command
73-
--warmup-count=INT Run benchmarks with -count=n as a warmup
74-
--warmup-time=STRING When warmups are run, set -benchtime=n
75-
76-
benchstat options:
77-
--alpha=0.05 consider change significant if p < α
78-
--benchstat-output="text" format for benchstat output (csv,html,markdown or text)
79-
--delta-test="utest" significance test to apply to delta: utest, ttest, or none
80-
--geomean print the geometric mean of each file
81-
--norange suppress range columns (CSV and markdown only)
82-
--reverse-sort reverse sort order
83-
--sort="none" sort by order: delta, name, none
84-
--split="pkg,goos,goarch" split benchmarks by labels
85-
86-
benchmark result cache:
87-
--cache-dir=STRING Override the default directory where benchmark output is kept.
88-
--clear-cache Remove benchdiff files from the cache dir.
89-
--show-cache-dir Output the cache dir and exit.
43+
--base-ref="HEAD" The git ref to be used as a baseline.
44+
--cooldown=100ms How long to pause for cooldown between head and base runs.
45+
--force-base Rerun benchmarks on the base reference even if the output already exists.
46+
--git-cmd="git" The executable to use for git commands.
47+
--json Format output as JSON.
48+
--on-degrade=0 Exit code when there is a statistically significant degradation in the
49+
results.
50+
--tolerance=10.0 The minimum percent change before a result is considered degraded.
51+
52+
benchmark command line
53+
--bench="." Run only those benchmarks matching a regular expression. To run all
54+
benchmarks, use '--bench .'.
55+
--benchmark-args=args Override the default args to the go command. This may be a template. See
56+
https://github.com/willabides/benchdiff for details."
57+
--benchmark-cmd="go" The command to use for benchmarks.
58+
--benchmem Memory allocation statistics for benchmarks.
59+
--benchtime=STRING Run enough iterations of each benchmark to take t, specified as a
60+
time.Duration (for example, --benchtime 1h30s). The default is 1 second
61+
(1s). The special syntax Nx means to run the benchmark N times (for
62+
example, -benchtime 100x).
63+
--count=10 Run each benchmark n times. If --cpu is set, run n times for each
64+
GOMAXPROCS value.'
65+
--cpu=GOMAXPROCS,... Specify a list of GOMAXPROCS values for which the benchmarks should be
66+
executed. The default is the current value of GOMAXPROCS.
67+
--packages="./..." Run benchmarks in these packages.
68+
--show-bench-cmdline Instead of running benchmarks, output the command that would be used and
69+
exit.
70+
--tags=STRING Set the -tags flag on the go test command
71+
--warmup-count=INT Run benchmarks with -count=n as a warmup
72+
--warmup-time=STRING When warmups are run, set -benchtime=n
73+
74+
benchstat options
75+
--alpha=0.05 consider change significant if p < α
76+
--benchstat-output="text" format for benchstat output (csv,html,markdown or text)
77+
--delta-test="utest" significance test to apply to delta: utest, ttest, or none
78+
--geomean print the geometric mean of each file
79+
--norange suppress range columns (CSV and markdown only)
80+
--reverse-sort reverse sort order
81+
--sort="none" sort by order: delta, name, none
82+
--split="pkg,goos,goarch" split benchmarks by labels
83+
84+
benchmark result cache
85+
--cache-dir=STRING Override the default directory where benchmark output is kept.
86+
--clear-cache Remove benchdiff files from the cache dir.
87+
--show-cache-dir Output the cache dir and exit.
9088
```
9189
<!--- end usage output --->
9290

cmd/benchdiff/benchdiff.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/alecthomas/kong"
1515
"github.com/willabides/benchdiff/cmd/benchdiff/internal"
16-
"github.com/willabides/benchdiff/cmd/benchdiff/internal/helpprinter"
1716
"github.com/willabides/benchdiff/pkg/benchstatter"
1817
"golang.org/x/perf/benchstat"
1918
)
@@ -243,8 +242,13 @@ func main() {
243242
benchVars["CacheDirDefault"] = filepath.Join(userCacheDir, "benchdiff")
244243

245244
kctx := kong.Parse(&cli, benchstatVars, benchVars, groupHelp,
246-
kong.Help(helpprinter.NewHelpPrinter(nil)),
247245
kong.Description(strings.TrimSpace(description)),
246+
kong.ExplicitGroups([]kong.Group{
247+
{Key: "benchstat", Title: "benchstat options"},
248+
{Key: "cache", Title: "benchmark result cache"},
249+
{Key: "gotest", Title: "benchmark command line"},
250+
{Key: "x"},
251+
}),
248252
)
249253

250254
benchArgs, err := getBenchArgs()

cmd/benchdiff/internal/helpprinter/guesswidth.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

cmd/benchdiff/internal/helpprinter/guesswidth_unix.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

cmd/benchdiff/internal/helpprinter/helpprinter.go

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)