Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Switch to owned types #4103

Merged
merged 9 commits into from Aug 22, 2022
Merged

fix: Switch to owned types #4103

merged 9 commits into from Aug 22, 2022

Conversation

epage
Copy link
Member

@epage epage commented Aug 22, 2022

Due to the binary size / performance trade off, I'm starting off by making smaller code size the default and we have a perf feature to instead ask for performan

The usability improvements from using owned types makes this worth the code size and performance penalty. For example, this allowed us to remove our dependency on once_cell.

Code size:

  • master: 556.6 KiB
  • default: 565.6 KiB
  • perf: 578.5 KiB

Build time:

  • master: 6.4950 us
  • default: 9.1706 us
  • perf: 7.0479 us

Parse time:

  • master: 7.7256 us
  • default: 12.673 us
  • perf: 8.1708 us

Parse with subcommand time:

  • master: 8.1580 us
  • default: 12.112 us
  • perf: 7.9874 us

Fixes #1041
Fixes #2150

Impact:
- Binary size: 556.6 KiB to 578.4 KiB
- build time: 6.4950 us (7% slower)
- parse time: 7.7256 us
- parse sc time: 8.1580 us (5% faster)

Fixes clap-rs#1041
Fixes clap-rs#2150
The downside is we can't skip allocations with
- `ValueEnum` default values
- Vaid subcommands

Otherwise, this is a big ergonomic win.
Impact
- Binary size: 556.6 KiB to 578.4 KiB to 574.6 KiB
- build time: 9.4581 us
- parse time: 13.055 us
- parse sc time: 13.384 us
Impact:
- Binary size: 556.6 KiB to 578.4 KiB 565.3 KiB
- build time: 9.6393 us
- parse time: 12.616 us
- parse sc time: 12.745 us
The binary size and performance difference is enough to make it
configurable.

Code size:
- default: 565.7 KiB
- perf: 578.5 KiB

Build time:
- default: 9.1706 us
- perf: 7.0479 us

Parse time:
- default: 12.673 us
- perf: 8.1708 us

Parse with subcommand time:
- default: 12.112 us
- perf: 7.9874 us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant