Skip to content

rosetta-rs/argparse-rosetta-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 234ms (full)
172ms (incremental)
3ms Y - -
argh 38 KiB 3s (full)
203ms (incremental)
4ms N Download count v0.1.10
bpaf 282 KiB 965ms (full)
236ms (incremental)
5ms Y Download count v0.9.4
bpaf_derive 276 KiB 4s (full)
238ms (incremental)
5ms Y Download count v0.9.4
clap 654 KiB 3s (full)
392ms (incremental)
4ms Y Download count v4.4.0
clap-minimal 427 KiB 2s (full)
330ms (incremental)
4ms Y Download count v4.4.0
clap_derive 689 KiB 6s (full)
410ms (incremental)
4ms Y Download count v4.4.0
clap_lex 27 KiB 407ms (full)
188ms (incremental)
3ms Y Download count v0.5.1
gumdrop 37 KiB 3s (full)
198ms (incremental)
3ms N Download count v0.8.1
lexopt 34 KiB 385ms (full)
184ms (incremental)
3ms Y Download count v0.3.0
pico-args 23 KiB 384ms (full)
185ms (incremental)
3ms Y Download count v0.5.0
xflags 22 KiB 709ms (full)
179ms (incremental)
3ms Y Download count v0.3.1

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

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

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