Skip to content

jirutka/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
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

Results

Name Overhead (release) Build (debug) Parse (release) Invalid UTF-8 Downloads Version
null 0 KiB 475ms (full)
328ms (incremental)
1ms Y - -
argp 44 KiB 8s (full)
436ms (incremental)
1ms Y Download count v0.3.0
argh 24 KiB 6s (full)
420ms (incremental)
1ms N Download count v0.1.10
bpaf 124 KiB 2s (full)
469ms (incremental)
2ms Y Download count v0.7.10
bpaf_derive 124 KiB 8s (full)
457ms (incremental)
2ms Y Download count v0.7.10
clap 348 KiB 7s (full)
746ms (incremental)
2ms Y Download count v4.2.0
clap-minimal 220 KiB 4s (full)
595ms (incremental)
2ms Y Download count v4.2.0
clap_derive 364 KiB 12s (full)
828ms (incremental)
2ms Y Download count v4.2.0
clap_lex 16 KiB 785ms (full)
394ms (incremental)
1ms Y Download count v0.4.1
gumdrop 20 KiB 6s (full)
422ms (incremental)
1ms N Download count v0.8.1
lexopt 20 KiB 755ms (full)
354ms (incremental)
1ms Y Download count v0.3.0
pico-args 16 KiB 732ms (full)
363ms (incremental)
6ms Y Download count v0.5.0
xflags 16 KiB 1s (full)
350ms (incremental)
1ms Y Download count v0.3.1

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" and strip = true.

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

Collected benchmarks for arg parsing crates written in Rust

Resources

License

Stars

Watchers

Forks

Languages

  • Python 100.0%