simplecov/rcov rbenv slowdown
Hi there,
I recently switched my installation from rvm with gemsets to rbenv with vendored bundles and the coverage generation step at the end of rspec calls has slowed down considerably. It seems odd that this would be a simplecov issue in and of itself but the slowdown vanishes if I disable the simplecov setup in the rails_helper.rb and I don't know where to start looking.
Here's the environment specifics:
- simplecov 0.11.2 (latest at time of writing, was 0.10.0, identical behaviour)
- simplecov-rcov 0.2.3 (latest at time of writing)
- ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
- rails 4.2.6
- rbenv 1.0.0
bundle config:
---
BUNDLE_BUILD__EVENTMACHINE: "--with-cppflags=-I/usr/local/opt/openssl/include"
BUNDLE_BIN: b
BUNDLE_PATH: ".bundle"
BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries"
rspec rails_helper.rb:
require 'simplecov'
require 'simplecov-rcov'
require 'pry'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start 'rails'
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
.. rest of file ..
Sample invocation:
$ time b/rspec spec/commands/v2/publish_spec.rb
...........................
Finished in 4.56 seconds (files took 3.71 seconds to load)
27 examples, 0 failures
Coverage report Rcov style generated for RSpec to [app_directory]/coverage/rcov
real 0m29.962s
user 0m25.435s
sys 0m2.226s
If it helps the entire app in question is here: https://github.com/alphagov/publishing-api/
Any thoughts?
I am having the issue on Jruby on Mac. Following are the environment details:
simplecov 0.11.2 simplecov-html (0.10.0) jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.60-b23 on 1.8.0_60-b27 +jit [darwin-x86_64] Rails 4.2.6 rbenv 1.0.0
Running all specs without simplecov (bundle exec rake spec) take 3 minutes and takes 15 mins with simplecov (bundle exec rake).
Thanks for the report. If you'd like to work on it, I'm happy to help with the PR.
@bf4 Do you have any thoughts on where I should start looking?
Hello everyone here! @elliotcm @uday-rayala
Could you please recheck with the newest version of simplecov (0.13) as it includes a couple of nice performance fixes.
Also, at work I've seen it that with vendored gems simplecov included the vendor directory and therefore had a lot more work to do parsing etc. there. So if you added a filter for the vendor directory, it might also help resolve the issue.
Hi @PragTob
I no longer work with the organisation who had this codebase, but fortunately it's public so I downloaded it and tried this out.
Running the same spec as above, I got the following results:
9.222s without rcov
32.791s with rcov, old version, no filter
11.021s with rcov, old version, with filter
11.327s with rcov, new version, with filter
Looks like the filter is the big hit here, thanks for the suggestion.
Glad it helped! :)
Was slightly confused as you wrote rcov which is the old thing - but all seems good :)
Thanks for the quick turnaround!
I don't really know the difference to be honest :) But I think there's some aspect of both in that codebase, as it seems to use that name in the output.
@elliotcm rcov was the ruby 1.8 (and maybe before) tool that gathered coverage data, it doesn't work in 1.9+ that's where simplecov (and the new coverage API comes in). The remnants of rcov probably come from a formatter that takes simplecov's output and formats it like rcov's - we do it in our CI as well because the CI knows how to read rcov reports but not how to read simplecov reports to display a trend of test coverage :)
Right, gotcha. Thanks :)