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

Parallel static analysis by default #10000

Merged
merged 1 commit into from Aug 12, 2021

Commits on Aug 11, 2021

  1. Parallel static analysis by default

    Modern PCs have multi-core. RuboCop has `--parallel` option, but it is
    not used by default. This means that there is extra core resources for
    static analysis because multi-core is not being used effectively.
    
    This PR will be parallel processing by default, so RuboCop will run
    faster in proportion to number of cores. Options that can be
    parallel processing, such as `--only`, `--except`, and others have the
    same default behavior.
    However, there are options that cannot be parallel processing, such as
    auto-correction and others, so they are serial processing as before.
    
    `--parallel` can be a hidden option for some users. This change is
    expected to reduce user's wait time for running RuboCop.
    
    Below is an example on my development PC.
    
    Before:
    
    ```console
    % cd path/to/rubocop
    ./exe/rubocop --display-time
    (snip)
    
    1293 files inspected, no offenses detected
    Finished in 61.09493000002112 seconds
    ```
    
    After:
    
    ```console
    % cd path/to/rubocop
    ./exe/rubocop --display-time
    (snip)
    
    1293 files inspected, no offenses detected
    Finished in 10.13813699997263 seconds
    ```
    
    If user's PC has a lot of cores, memory and RuboCop targets a lot of files
    to inspect, it will be effective.
    
    One concern is that parallel processing uses more memory. For example,
    Ruby's MJIT is off by default as an example of concerning about memory
    consumption in a low memory production runtime (e.g. Heroku's minimum Dyno).
    However, RuboCop is a development tool, I assume that it will be fine
    in most cases.
    
    If user want to use it in a low memory production runtime, user can
    specify `--no-parallel`.
    
    Note: JRuby and Windows are not supported based on rubocop#4537.
    koic committed Aug 11, 2021
    Copy the full SHA
    0739982 View commit details
    Browse the repository at this point in the history