Rust Arg Parsing Benchmarks
March 9, 2026 ยท View on GitHub
This repo tries to assess Rust arg parsing performance.
We currently compare:
| Name | Style | Notes |
|---|---|---|
| No-op | N/A | N/A |
| 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
Results
| Name | Overhead (release) | Build (debug) | Parse (release) | Invalid UTF-8 | Downloads | Version |
|---|---|---|---|---|---|---|
| null | 0 KiB | 163ms (full) 115ms (incremental) | 1ms | Y | - | - |
| argh | 38 KiB | 4s (full) 138ms (incremental) | 2ms | N | v0.1.14 | |
| bpaf | 256 KiB | 831ms (full) 137ms (incremental) | 2ms | Y | v0.9.23 | |
| bpaf_derive | 253 KiB | 4s (full) 140ms (incremental) | 2ms | Y | v0.9.23 | |
| clap | 574 KiB | 3s (full) 170ms (incremental) | 2ms | Y | v4.5.60 | |
| clap-minimal | 377 KiB | 2s (full) 155ms (incremental) | 2ms | Y | v4.5.60 | |
| clap_derive | 596 KiB | 4s (full) 182ms (incremental) | 2ms | Y | v4.5.60 | |
| clap_lex | 28 KiB | 336ms (full) 129ms (incremental) | 2ms | Y | v1.0.0 | |
| gumdrop | 28 KiB | 2s (full) 135ms (incremental) | 1ms | N | v0.8.1 | |
| lexopt | 37 KiB | 329ms (full) 124ms (incremental) | 2ms | Y | v0.3.2 | |
| pico-args | 24 KiB | 300ms (full) 123ms (incremental) | 2ms | Y | v0.5.0 | |
| xflags | 23 KiB | 539ms (full) 123ms (incremental) | 1ms | Y | v0.3.2 |
System: Linux 6.17.9-76061709-generic (x86_64), rustc 1.94.0 (4a4ef493e 2026-03-02) w/ -j 8
Notes:
- Overhead will be lower if your application shares dependencies with your argument parsing library.
Running the Benchmarks
$ ./bench.py
$ ./format.py
To be included, the crate needs meet one of the following criteria:
- 10k+ recent downloads
- Unique API design
Special Thanks
- RazrFalcon for creating the initial benchmarks
- djc for inspiration with template-benchmarks-rs
- sharkdp for hyperfine