simplecov-ruby / simplecov

Code coverage for Ruby with a powerful configuration library and automatic merging of coverage across test suites
MIT License
4.78k stars 553 forks source link

Simplecov slows down rspec after upgrading from 0.10.0 #543

Closed akshah123 closed 7 years ago

akshah123 commented 7 years ago

I am seeing my rspec run slowed down drastically after upgrading from 0.10.0.

Here is timed run using simplecov 0.10.0:

vagrant@vagrant:/var/www/project$time COVERAGE=1 rspec spec/controllers/v2/professionals_controller_spec.rb
....
Finished in 8.45 seconds (files took 7.81 seconds to load)
12 examples, 0 failures

Randomized with seed 27474

Coverage report generated for RSpec to /var/www/project/coverage. 5134 / 8545 LOC (60.08%) covered.

real    0m29.653s
user    0m14.122s
sys     0m4.795s

The actual spec tests takes

Here is the same test run using 0.12.0. The only difference here is version of simplecov:

vagrant@vagrant:/var/www/project$ time COVERAGE=1 rspec spec/controllers/v2/professionals_controller_spec.rb
...

Finished in 8.8 seconds (files took 9.06 seconds to load)
12 examples, 0 failures

Randomized with seed 33321

Coverage report generated for RSpec to /var/www/project/coverage. 5134 / 22394 LOC (22.93%) covered.

real    0m44.854s
user    0m18.200s
sys     0m5.720s

As you can see the different is pretty large. 45 seconds vs 30 seconds. Another thing to note is also the difference between total LOC.

Above results are just for one test. The problem is worse when I run the entire test suite. With 0.12.0, it is taking twice as long.

I am not sure how to proceed further but any guidance would be appreciated.

akshah123 commented 7 years ago

I am going to close this issue since the slowness does not increase as the tests are added. Perhaps there is some extra overhead but it seems to be a fixed amount.