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

An optimization for pest-2.1.3 #98654

Merged
merged 2 commits into from
Jul 8, 2022
Merged

Commits on Jun 29, 2022

  1. Change Search::infcx to tcx.

    Because the `infcx` isn't needed. This removes one lifetime from
    `Search`.
    nnethercote committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    9e76fcc View commit details
    Browse the repository at this point in the history
  2. Avoid constructing an unnecessary InferCtxt.

    Currently, `search_for_structural_match_violation` constructs an `infcx`
    from a `tcx` and then only uses the `tcx` within the `infcx`. This is
    wasteful because `infcx` is a big type.
    
    This commit changes it to use the `tcx` directly. When compiling
    `pest-2.1.3`, this changes the memcpy stats reported by DHAT for a `check full`
    build from this:
    ```
    433,008,916 bytes (100%, 99,787.93/Minstr) in 2,148,668 blocks (100%, 495.17/Minstr), avg size 201.52 bytes
    ```
    to this:
    ```
    101,422,347 bytes (99.98%, 25,243.59/Minstr) in 1,318,407 blocks (99.96%, 328.15/Minstr), avg size 76.93 bytes
    ```
    This translates to a 4.3% reduction in instruction counts.
    nnethercote committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    687e391 View commit details
    Browse the repository at this point in the history