fix: Switch to owned types#4103
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Due to the binary size / performance trade off, I'm starting off by making smaller code size the default and we have a
perffeature to instead ask for performanThe 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:
Build time:
Parse time:
Parse with subcommand time:
Fixes #1041
Fixes #2150