Skip to content
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

Merged
merged 1 commit into from
Sep 23, 2016

Conversation

alyssais
Copy link
Contributor

@alyssais alyssais commented Sep 22, 2016

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run 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.

@alyssais
Copy link
Contributor Author

Looks like CI is about 5 minutes faster with this change. 😃

Copy link
Member

@reitermarkus reitermarkus left a 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)
Copy link
Member

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)).

Copy link
Contributor Author

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.

@alyssais alyssais mentioned this pull request Sep 22, 2016
5 tasks
@MikeMcQuaid
Copy link
Member

Massive speedup, great work. Is it work updating both the Homebrew and Cask tests Gemfile.lock to pull in the master branch and your commit in simplecov-ruby/simplecov#520 to further speed things up?

@alyssais
Copy link
Contributor Author

@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.

@MikeMcQuaid
Copy link
Member

@penman Cool. Happy to wait on that one. One conflict to resolve here then happy to 🚢.

@alyssais
Copy link
Contributor Author

@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.
@MikeMcQuaid MikeMcQuaid merged commit 8989275 into Homebrew:master Sep 23, 2016
@MikeMcQuaid
Copy link
Member

👏 for dramatic speedup!

@alyssais alyssais deleted the fast_integration_tests branch September 23, 2016 11:57
alyssais added a commit to alyssais/brew that referenced this pull request Nov 14, 2016
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.
@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants