Skip to content
mycli.usage.kdl
name "mycli"
flag "-v --verbose" help="Enable verbose output"
arg "<file>" help="File to process"
cmd "deploy" { flag "--env <env>" }

Benchmarks

Parser overhead

What parsing mise use -g node@20 costs each framework, against a shadow of mise's CLI: 211 commands, 711 flags. Every shadow is generated from the same spec by the same traversal, so what differs is the parser rather than one of them being written more carefully.

usage-rs vs clap, argh, bpaf

wall time, in-process parse throughput How this is measured Each parser runs repeatedly inside one process; process startup is excluded, so these bars are not full CLI invocation times. The chart reports the fastest per-parse time from many short rounds. Minima and their ratios drift a few percent between runs and machines, hence the ~. Instructions for one cold parse, which do not drift: 4,155 · 6,295 · 5.89M · 21.9M, agreeing across two machines to 0.15%.

usage-rs190 ns
argh270 ns · 1.4× more
clap480 µs · ~2,500× more
bpaf1.6 ms · ~8,200× more

clap and bpaf build a parser before they can use one Where their time goes Most of clap's is constructing and validating its command tree. bpaf's is larger because it assembles a combinator tree per run as well, which reusing the parser across parses only halves. . Heap allocations for a bare parse: zero, against clap's 6,280. argh and bpaf also express less Missing from the argh and bpaf shadows Aliases, hidden commands, global flags, and a positional beside a subcommand — the generator drops them, counts them, and prints the count when it runs. .

usage-go vs cobra, urfave/cli, kong

wall time, one cold parse How this is measured Whole-process, with the ~0.95ms of Go runtime startup a do-nothing process costs subtracted — approximate, and the reason the Rust card is timed in-process instead.

usage-go~0.15ms
urfave/cli v3~0.75ms · ~5× more
cobra~0.85ms · ~6× more
kong~5.2ms · ~35× more

Instructions for the same parse: ~2.7k vs cobra's 2.0M, urfave/cli's 5.6M, kong's 57.9M.

Methodology and raw numbers: go/README.md · tasks/perf-shadow.sh · time-sweep.rs

MIT LicenseCopyright © 2026jdx.dev