reek: ControlParameter inordinately slow on certain files

Reek is very slow on large files containing lots of comments. These are often files containing few lines of code, for instance API interfaces, with many lines of comments documenting the functions.

Examples are bench/example.ruby in here and gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb in here.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (13 by maintainers)

Most upvoted comments

I started reek and pressed Ctrl-C. Then I did it again. In both cases, the stack trace contained control_parameter, with suspiciously deep nesting in #legitimate_uses?.

Then I disabled ControlParameter and ran reek again: Done in 0.11s.

@retrography we just released 5.0.2. with a bug fix, can you please check if that works better for you? Running Reek on your ruby.rb file now takes less than a second for me.

P.S.: I updated your title to “Reek inordinately slow on certain files” since the original title was now misleading 😉

I found the culprit:

 time reek scanners/ruby.rb

real	7m6.357s
user	6m58.592s
sys	0m2.469s

Interestingly ruby.rb doesn’t look as bad as I had expected. It’s basically a huge ~ 400 lines long method, that’s it.