Skip to content

rosetta-rs/argparse-rosetta-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

302 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Arg Parsing Benchmarks

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 Download count v0.1.14
bpaf 256 KiB 831ms (full)
137ms (incremental)
2ms Y Download count v0.9.23
bpaf_derive 253 KiB 4s (full)
140ms (incremental)
2ms Y Download count v0.9.23
clap 574 KiB 3s (full)
170ms (incremental)
2ms Y Download count v4.5.60
clap-minimal 377 KiB 2s (full)
155ms (incremental)
2ms Y Download count v4.5.60
clap_derive 596 KiB 4s (full)
182ms (incremental)
2ms Y Download count v4.5.60
clap_lex 28 KiB 336ms (full)
129ms (incremental)
2ms Y Download count v1.0.0
gumdrop 28 KiB 2s (full)
135ms (incremental)
1ms N Download count v0.8.1
lexopt 37 KiB 329ms (full)
124ms (incremental)
2ms Y Download count v0.3.2
pico-args 24 KiB 300ms (full)
123ms (incremental)
2ms Y Download count v0.5.0
xflags 23 KiB 539ms (full)
123ms (incremental)
1ms Y Download count 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

About

Comparing argparse APIs

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages