This repo tries to assess Rust arg parsing performance.
We currently compare:
Name | Style | Notes |
---|---|---|
No-op | N/A | N/A |
argp | derive |
Added in this fork |
argh | derive |
|
bpaf | Combinatoric or derive |
|
clap_lex | Imperative | No help generation |
clap | Builder or derive |
Color, suggested fixes, completions |
gumdrop | derive |
|
lexopt | Imperative | No help generation |
pico-args | Imperative | No help generation |
xflags | proc-macro |
See also an examination of design trade offs
Note: any non-performance comparison is meant to provide context for what you gain/lose with each crate's overhead. For a full comparison, see each parser docs
System: Linux 5.15.0-1034-azure (x86_64) w/ -j 2
(GitHub actions, see log)
rustc: rustc 1.68.2 (9eb3afe9e 2023-03-27)
Notes:
- Overhead will be lower if your application shares dependencies with your argument parsing library.
- Size is measured on release builds with
panic = "abort"
andstrip = true
.
$ ./bench.py
$ ./format.py
To be included, the crate needs meet one of the following criteria:
- 10k+ recent downloads
- Unique API design
- RazrFalcon for creating the initial benchmarks
- djc for inspiration with template-benchmarks-rs
- sharkdp for hyperfine