Skip to content

[RUN ALL RSPEC] Speed up last keyword cop

Thong Kuah requested to merge speed_up_last_keyword_cop into master

What does this MR do?

Optimizes a slow function in the LastKeywordArgument cop. See benchmark

$ ruby rubocop/cop/lint/benchmark.rb
true
true
       user     system      total        real
master   142.525172   0.218874 142.744046 (143.294277)
optimized 30.805534   0.045903  30.851437 ( 31.005048)

benchmark.rb

Running time bundle exec rubocop --only Lint/LastKeywordArgument --parallel takes about 1 minute faster for me locally (2:40 vs 1:40)

On CI, we have improved the rspec:deprecations job from 13 minutes to 6 minutes

Edited by Thong Kuah

Merge request reports

Loading