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

Significantly optimize parsing overhead when --since is specified #1382

Merged
merged 2 commits into from
May 22, 2023

Commits on May 21, 2023

  1. Remove redundant skipped candidate specs

    - An identical expectation is included via the `skipped candidate` shared example in `spec/shared/method_matcher_behavior.rb`.
    dgollahon committed May 21, 2023
    Configuration menu
    Copy the full SHA
    3cbf65c View commit details
    Browse the repository at this point in the history

Commits on May 22, 2023

  1. Change to more efficient subject matching in presence of repository d…

    …iffs
    
    * Avoids parsing source files that live outside the specified diff.
    * Massively speeds up boot time on larger codebases and should be noticeable on all sizes.
      On `mutant` itself, when making a relatively targeted change (such as this one),
      boot time is reduced by about 0.7 seconds (~20% faster).
      On a larger project I work on, the speed up was 24 seconds or 2.5x faster overall!
      I left the original, full, subject filtering in place to simplify this change.
      This just short-circuits when the files we are interested in are not modified
      and `--since` is specified.
      * `mutant` run before on this change:
        ```
        Benchmark 1: bundle exec mutant run --zombie --since HEAD~1 --profile
        Time (mean ± σ):      4.192 s ±  0.350 s    [User: 8.567 s, System: 6.081 s]
        Range (min … max):    3.850 s …  4.960 s    10 runs
        ```
      * `mutant` run after on this change:
        ```
        Benchmark 1: bundle exec mutant run --zombie --since HEAD~1 --profile
        Time (mean ± σ):      3.535 s ±  0.213 s    [User: 6.890 s, System: 5.784 s]
        Range (min … max):    3.188 s …  3.784 s    10 runs
        ```
    * Also reduces memory consumption significantly since the ASTs for all source files
      are never constructed.
      In my larger project on very small single subject change it reduced memory
      allocations by 69MB (80% reduction) and reduced "retained" memory by 25MB
      (99.4% reduction).
    dgollahon authored and mbj committed May 22, 2023
    Configuration menu
    Copy the full SHA
    d115fc6 View commit details
    Browse the repository at this point in the history