Home

Awesome

Rust Arg Parsing Benchmarks

This repo tries to assess Rust arg parsing performance.

We currently compare:

NameStyleNotes
No-opN/AN/A
arghderive
bpafCombinatoric or derive
clap_lexImperativeNo help generation
clapBuilder or deriveColor, suggested fixes, completions
gumdropderive
lexoptImperativeNo help generation
pico-argsImperativeNo help generation
xflagsproc-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

NameOverhead (release)Build (debug)Parse (release)Invalid UTF-8DownloadsVersion
null0 KiB234ms (full) <br/>172ms (incremental)3msY--
argh38 KiB3s (full) <br/>203ms (incremental)4msNDownload countv0.1.10
bpaf282 KiB965ms (full) <br/>236ms (incremental)5msYDownload countv0.9.4
bpaf_derive276 KiB4s (full) <br/>238ms (incremental)5msYDownload countv0.9.4
clap654 KiB3s (full) <br/>392ms (incremental)4msYDownload countv4.4.0
clap-minimal427 KiB2s (full) <br/>330ms (incremental)4msYDownload countv4.4.0
clap_derive689 KiB6s (full) <br/>410ms (incremental)4msYDownload countv4.4.0
clap_lex27 KiB407ms (full) <br/>188ms (incremental)3msYDownload countv0.5.1
gumdrop37 KiB3s (full) <br/>198ms (incremental)3msNDownload countv0.8.1
lexopt34 KiB385ms (full) <br/>184ms (incremental)3msYDownload countv0.3.0
pico-args23 KiB384ms (full) <br/>185ms (incremental)3msYDownload countv0.5.0
xflags22 KiB709ms (full) <br/>179ms (incremental)3msYDownload countv0.3.1

System: Linux 5.4.0-124-generic (x86_64) w/ -j 8

rustc: rustc 1.72.0 (5680fa18f 2023-08-23)

Notes:

Running the Benchmarks

$ ./bench.py
$ ./format.py

To be included, the crate needs meet one of the following criteria:

Special Thanks