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

Optimize Base#relevant_rubocop_rspec_file? #967

Closed
wants to merge 1 commit into from

Commits on Aug 22, 2020

  1. Optimize Cop#relevant_rubocop_rspec_file?

    The result of `rspec_pattern` is always the same (because it is based
    on the configuration file), so there is no need to re-calculate it every
    time it is called.
    
    I tried memozing on the Cop instance, but at least when running the
    specs, we instantiate Cop way too often. Memoizing on the class level
    reduces the number of calculations to once per `Cop` subclass we have.
    If we allowed using class variables (`@@rspec_pattern`) we could reduce
    the number of calculations to one.
    
    This commit reverts 995b4fe and adds
    memoization in a class instance variable.
    bquorning committed Aug 22, 2020
    Configuration menu
    Copy the full SHA
    ab89845 View commit details
    Browse the repository at this point in the history