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 #10919] Fix a huge performance regression between 1.32.0 and 1.33.0 #10953

Merged
merged 1 commit into from Aug 26, 2022

Conversation

ydah
Copy link
Member

@ydah ydah commented Aug 24, 2022

Fix: #10919

Before:

  • 1.32.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 2.7.2 x86_64-darwin21)

bundle exec rubocop --cache false --only 16.83s user 1.30s system 93% cpu 19.320 total

  • 1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 2.7.2 x86_64-darwin21)

bundle exec rubocop --cache false --only 1255.21s user 5.32s system 71% cpu 29:17.76 total

After:

bundle exec rubocop --cache false --only 16.64s user 1.25s system 94% cpu 19.002 total


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@@ -17,16 +17,21 @@ def allowed_method?(name)

# @api public
def allowed_methods
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[memo] The reason for the slow speed was due to this method.
If the following settings were used

Style/MethodCallWithArgsParentheses:
  IgnoredMethods:
    - abort
    - after_save
    - and
    - before_save
    - delegate
    - describe
    - exec
    - exit
    - load
    - not_to
    - p
    - print
    - puts
    - raise
    - require
    - shared_context
    - shared_examples
    - star_puts
    - throw
    - to
    - warn
    - yield

it was returning the following results (increasing with each file)

["abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield", "abort", "after_save", "and", "before_save", "delegate", "describe", "exec", "exit", "load", "not_to", "p", "print", "puts", "raise", "require", "shared_context", "shared_examples", "star_puts", "throw", "to", "warn", "yield"]

@@ -951,33 +951,6 @@ def a; end
YAML
end

context 'when configurable parameter is an obsolete parameter' do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a test added in #10875. However, this specification was incorrect. In fact, I think the cop_config was broken, causing duplicates to be displayed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it necessary to update the test as originally intended? I'm worried about losing a regression spec for #10875.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it is. I will modify the test a bit and add it.

Copy link
Member Author

@ydah ydah Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. I've tried running the following test and it seems to fail.

Maybe there is some other problem.
Should we include the resolution of that issue as part of this PR?

    context 'when duplicated parameter' do
      it 'parameters are displayed without duplication' do
        create_file('.rubocop.yml', <<~YAML)
          AllCops:
            NewCops: enable
          Lint/AmbiguousBlockAssociation:
            AllowedMethods:
              - change
              - not_change
              - change
        YAML
        create_file('example1.rb', ['# frozen_string_literal: true', '', 'def fooBar; end'])
        create_file('example2.rb', ['# frozen_string_literal: true', '', 'def fooBar; end'])

        expect(cli.run(['--auto-gen-config'])).to eq(0)
        File.readlines('.rubocop_todo.yml')
        expect(File.readlines('.rubocop_todo.yml')[9..].join)
          .to eq(<<~YAML)
            # Configuration parameters: AllowedPatterns, IgnoredPatterns.
            # SupportedStyles: snake_case, camelCase
            # AllowedPatterns: change, not_change
            Naming/MethodName:
              EnforcedStyle: camelCase
          YAML
      end
    end
Failures:

  1) RuboCop::CLI --auto-gen-config --auto-gen-config when duplicated parameter parameters are displayed without duplication
     Failure/Error:
       expect(File.readlines('.rubocop_todo.yml')[9..].join)
         .to eq(<<~YAML)
           # Configuration parameters: AllowedPatterns, IgnoredPatterns.
           # SupportedStyles: snake_case, camelCase
           # AllowedPatterns: change, not_change
           Naming/MethodName:
             EnforcedStyle: camelCase
         YAML
     
       expected: "# Configuration parameters: AllowedPatterns, IgnoredPatterns.\n# SupportedStyles: snake_case, camelCase\n# AllowedPatterns: change, not_change\nNaming/MethodName:\n  EnforcedStyle: camelCase\n"
            got: "# Configuration parameters: AllowedPatterns, IgnoredPatterns.\n# SupportedStyles: snake_case, camelCase\nNaming/MethodName:\n  EnforcedStyle: camelCase\n"
     
       (compared using ==)
     
       Diff:
       @@ -1,6 +1,5 @@
        # Configuration parameters: AllowedPatterns, IgnoredPatterns.
        # SupportedStyles: snake_case, camelCase
       -# AllowedPatterns: change, not_change
        Naming/MethodName:
          EnforcedStyle: camelCase
       
     # ./spec/rubocop/cli/auto_gen_config_spec.rb:970:in `block (4 levels) in <top (required)>'
     # ./spec/support/cli_spec_behavior.rb:26:in `block (2 levels) in <top (required)>'
     # ./lib/rubocop/rspec/shared_contexts.rb:30:in `block (4 levels) in <top (required)>'
     # ./lib/rubocop/rspec/shared_contexts.rb:30:in `chdir'
     # ./lib/rubocop/rspec/shared_contexts.rb:30:in `block (3 levels) in <top (required)>'
     # ./lib/rubocop/rspec/shared_contexts.rb:7:in `block (2 levels) in <top (required)>'

Finished in 7.11 seconds (files took 1.06 seconds to load)
40 examples, 1 failure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need guarantees for existing behavior against performance regression solutions. I'm wondering whether another issue is included due to the test failing.

Copy link
Member Author

@ydah ydah Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I would like to run the same test code on the old version to check the existing behavior first. Thank you.

Copy link
Member Author

@ydah ydah Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted below, the display of this configuration value is the configuration value in config/default.yml and we have decided to modify the test.
#10953 (comment)

@dvandersluis
Copy link
Member

Good catch! Would any other cops changed in #10829 be affected?

@ydah
Copy link
Member Author

ydah commented Aug 24, 2022

@dvandersluis Yes. I think so. And parameters obsoleted in #10555 had the same problem. These will also be resolved.

Comment on lines +955 to +958
before do
RuboCop::ConfigLoader.default_configuration['Naming/MethodParameterName']
.merge!('AllowedNames' => %w[at by at])
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration values like # AllowedNames: at, by that appear in .rubocop_todo.yml were not configuration values in .rubocop.yml, but default values in config/defautl.yml.
However, what appeared to be the .rubocop.yml configuration values in #10875 . This was due to the default values being corrupted by the problem fixed in this PR.
Therefore, it was necessary to duplicate parameter the config/defautl.yml here.

@ydah ydah requested a review from koic August 24, 2022 03:44
…and 1.33.0

Fix: rubocop#10919

Before:
- 1.32.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 2.7.2 x86_64-darwin21)

`bundle exec rubocop --cache false --only   16.83s user 1.30s system 93% cpu 19.320 total`

- 1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 2.7.2 x86_64-darwin21)

`bundle exec rubocop --cache false --only   1255.21s user 5.32s system 71% cpu 29:17.76 total`

After:

`bundle exec rubocop --cache false --only 16.64s user 1.25s system 94% cpu 19.002 total`
@koic koic merged commit 54027a3 into rubocop:master Aug 26, 2022
@koic
Copy link
Member

koic commented Aug 26, 2022

Thanks!

@tjchambers
Copy link

Interesting.

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.

Huge performance regression between 1.32.0 and 1.34.1
4 participants