-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: speed up integration tests coverage #1084
Conversation
Looks like CI is about 5 minutes faster with this change. 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
# Just save result, but don't write formatted output. | ||
coverage_result = Coverage.result | ||
SimpleCov.add_not_loaded_files(coverage_result) | ||
simplecov_result = SimpleCov::Result.new(coverage_result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a speed difference here between SimpleCov::Result.new(Coverage.result)
and SimpleCov::Result.new(SimpleCov.add_not_loaded_files(Coverage.result))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. SimpleCov.add_not_loaded_files(x)
just returns x
, so I split it out of one long method chain for readability.
Massive speedup, great work. Is it work updating both the Homebrew and Cask tests |
@MikeMcQuaid I tried it out, but now that we're not accidentally loading in 10000 files it only ended up making a 1 second difference. It looks like #1089 does this anyway. |
@penman Cool. Happy to wait on that one. One conflict to resolve here then happy to 🚢. |
@MikeMcQuaid great! I'll have that done in a few hours when I'm back at a computer. :) |
Previously, .simplecov called `SimpleCov.result` to store the coverage result, and ignored the return value. `SimpleCov.result`'s return can be slow to calculate, which wastes a lot of time when it's ignored. This commit extracts the code needed to store the SimpleCov result from `SimpleCov.result`, and calls it directly, without doing the busywork to compute the return value every time. In my testing, this more than halves the time taken to run all the integration tests.
e91b447
to
5f6a8d4
Compare
👏 for dramatic speedup! |
Suggested in Homebrew#1084. Made the existing warning output entirely to STDERR, because previously the first line went to STDERR and subsequent ones went to STDOUT.
brew tests
with your changes locally?This is the speed-up I was referring to in #1041.
Previously, .simplecov called
SimpleCov.result
to store the coverage result, and ignored the return value.SimpleCov.result
's return can be slow to calculate, which wastes a lot of time when it's ignored.This pull request extracts the code needed to store the SimpleCov result from
SimpleCov.result
, and calls it directly, without doing the busywork to compute the return value every time.In my testing, this more than halves the time taken to run all the integration tests.