Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information