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(parser)!: Store args in a group, rather than values #4072

Merged
merged 11 commits into from Aug 12, 2022

Commits on Aug 12, 2022

  1. refactor: Move commands off of Id

    This is prep for changing out the types
    
    This dropped the size by 0.4 KB
    epage committed Aug 12, 2022
    Copy the full SHA
    d7735d5 View commit details
    Browse the repository at this point in the history
  2. refactor: Abstract away name's access

    This is prep for merging name/id
    epage committed Aug 12, 2022
    Copy the full SHA
    ca046aa View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    1849d56 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    f1b86a6 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    426a7d2 View commit details
    Browse the repository at this point in the history
  6. refactor(assert): Make it easier to change id type

    Compared to `master` on `06_rustup`:
    - build: 5.74us -> 6.21us
    - parse: 7.57us -> 7.55us
    - parse_sc: 7.60us -> 7.95us
    epage committed Aug 12, 2022
    Copy the full SHA
    96f91ca View commit details
    Browse the repository at this point in the history
  7. fix!: Switch from &[] to IntoIterator

    This is a part of clap-rs#2870 and is prep for clap-rs#1041
    
    Oddly enough, this dropped the binary size by 200 Bytes
    
    Compared to `HEAD~` on `06_rustup`:
    - build: 6.21us -> 6.23us
    - parse: 7.55us -> 8.17us
    - parse_sc: 7.95us -> 7.65us
    epage committed Aug 12, 2022
    Copy the full SHA
    f84e38a View commit details
    Browse the repository at this point in the history
  8. fix!: Track original Ids, rather than a hash

    This is a step towards clap-rs#1041
    - `ArgGroup` no longer takes a lifetime
    - One less field type needs a lifetime
    
    For now, we are using a more brute force type (`String`) so we can
    establish performance base lines.  I was torn on whether to use `&str`
    everywhere or make an `IdRef`.  The latter would add a lot of noise that
    I'm concerned about, so i left it simple for now.  `IdRef` would help to
    communicate the types involved though.
    
    Speaking of communicating types, I'm also torn on whether we should use
    `Id` for all strings or if we should have `Id`, `Name`, etc types to
    avoid people mixing and matching.
    
    This added 18.7 KB.
    
    Compared to `HEAD~` on `06_rustup`:
    - build: 6.23us -> 7.41us
    - parse: 8.17us -> 9.36us
    - parse_sc: 7.65us -> 9.29us
    epage committed Aug 12, 2022
    Copy the full SHA
    5b5f2c1 View commit details
    Browse the repository at this point in the history
  9. perf: Track static strs for Id

    Unfortunately, this added another 6.6 KB
    
    Compared to `HEAD~` on `06_rustup`:
    - build: 7.41us -> 6.28us
    - parse: 9.36us -> 8.07us
    - parse_sc: 9.29us -> 7.74us
    
    For context, this run compares `HEAD` to `v3-master`
    ```
    build_rustup            time:   [10.765 µs 10.869 µs 10.981 µs]
                            change: [+72.716% +74.316% +75.832%] (p = 0.00 < 0.05)
                            Performance has regressed.
    parse_rustup            time:   [14.264 µs 14.329 µs 14.407 µs]
                            change: [+75.565% +76.899% +78.172%] (p = 0.00 < 0.05)
                            Performance has regressed.
    parse_rustup_with_sc    time:   [14.947 µs 15.025 µs 15.107 µs]
                            change: [+92.606% +94.079% +95.573%] (p = 0.00 < 0.05)
                            Performance has regressed.
    ```
    So anything we are doing at this point is a large improvement.
    epage committed Aug 12, 2022
    Copy the full SHA
    43ca9a2 View commit details
    Browse the repository at this point in the history
  10. feat: Publicly expose Id

    epage committed Aug 12, 2022
    Copy the full SHA
    004de00 View commit details
    Browse the repository at this point in the history
  11. fix(parser)!: Store args in a group, rather than values

    Now that `Id` is public, we can have `ArgMatches` report them.  If we
    have to choose one behavior, this is more universal.  The user can still
    look up the values, this works with groups whose args have different
    types, and this allows people to make decisions off of it when otherwise
    there isn't enogh information.
    
    Fixes clap-rs#2317
    Fixes clap-rs#3748
    epage committed Aug 12, 2022
    Copy the full SHA
    41be1be View commit details
    Browse the repository at this point in the history