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

Replace clap with a simple hand-written arg parser #411

Merged
merged 2 commits into from
Aug 8, 2023
Merged

Conversation

osa1
Copy link
Owner

@osa1 osa1 commented Aug 7, 2023

clap is too heavyweight for what tiny needs. Replacing it with a simple hand-written parser reduces debug binary sizes a constant 14 MiB (!), and release binary sizes ~400 KiB.

  • Default build, debug:

    • Before: 73M
    • After: 59M
    • Diff: -14M, -29%
  • Default build, release:

    • Before: 6.4M
    • After: 6.0M
    • Diff: -0.4M, -6%
  • Native TLS build, release:

    • Before: 4.6M
    • After: 4.2M
    • Diff: -0.4M, -8%

Also saves ~10s build time and ~3s cargo check time.

Error messages and the help message is copied from what clap printed and modified.

clap is too heavyweight for what tiny needs. Replacing it with a simple
hand-written parser reduces debug binary sizes a constant 14 MiB (!), and
release binary sizes ~400 KiB.

- Default build, debug:
  - Before: 73M
  - After: 59M
  - Diff: -14M, -29%

- Default build, release:
  - Before: 6.4M
  - After: 6.0M
  - Diff: -0.4M, -6%

- Native TLS build, release:
  - Before: 4.6M
  - After: 4.2M
  - Diff: -0.4M, -8%

Also saves ~10s build time and ~3s `cargo check` time.
@osa1 osa1 merged commit 0903046 into master Aug 8, 2023
10 checks passed
@osa1 osa1 deleted the refactor_cli branch August 8, 2023 06:50
@ddiss
Copy link

ddiss commented Aug 30, 2023

🥳 thanks a lot for keeping tiny tiny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants