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

Don't clear digest cache in test environment #27271

Merged
merged 1 commit into from Dec 7, 2016

Conversation

Projects
None yet
8 participants
@printercu
Contributor

printercu commented Dec 5, 2016

TL/DR rspec spec/integration. Before: 35sec. After patch: 20sec.

#20384 implemented template digest expiry for dev requests. It's enabled by default for test env, which is not required and degradates test performance.

I'm not sure if there should be testcase for this commit.

UPD There is failing test on travis. But it's for actioncable, and passes locally for me.

@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Dec 5, 2016

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

rails-bot commented Dec 5, 2016

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@printercu

This comment has been minimized.

Show comment
Hide comment
@printercu

printercu Dec 5, 2016

Contributor

@matthewd it would be great to have this one in 5.0.1.

Contributor

printercu commented Dec 5, 2016

@matthewd it would be great to have this one in 5.0.1.

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Dec 5, 2016

Member

Why it degradates performance? I prefer to fix the performance issue before disabling it.

Member

rafaelfranca commented Dec 5, 2016

Why it degradates performance? I prefer to fix the performance issue before disabling it.

@printercu

This comment has been minimized.

Show comment
Hide comment
@printercu

printercu Dec 5, 2016

Contributor

Because it recompiles templates on every request, instead of using cached ones.

Contributor

printercu commented Dec 5, 2016

Because it recompiles templates on every request, instead of using cached ones.

@matthewd

This comment has been minimized.

Show comment
Hide comment
@matthewd

matthewd Dec 5, 2016

Member

To be clear, you're not saying that something got slower... you're saying that the change in #20384 can be adjusted to cache more aggressively in tests, and that makes them faster. Right?

Member

matthewd commented Dec 5, 2016

To be clear, you're not saying that something got slower... you're saying that the change in #20384 can be adjusted to cache more aggressively in tests, and that makes them faster. Right?

@printercu

This comment has been minimized.

Show comment
Hide comment
@printercu

printercu Dec 5, 2016

Contributor

Nope. The change in #20384 totally disables caching templates between requests. I've been migrating from 4.2 and found that integration tests got almost 2 times slower. With stackprof I've found that there got too much time in ActionView::Template#compile.

Contributor

printercu commented Dec 5, 2016

Nope. The change in #20384 totally disables caching templates between requests. I've been migrating from 4.2 and found that integration tests got almost 2 times slower. With stackprof I've found that there got too much time in ActionView::Template#compile.

@printercu

This comment has been minimized.

Show comment
Hide comment
@printercu

printercu Dec 5, 2016

Contributor

I've added this lines to test helper, and this decreased tests time back to 4.2's time:

class << ActionView::LookupContext::DetailsKey
  def clear
  end
end
Contributor

printercu commented Dec 5, 2016

I've added this lines to test helper, and this decreased tests time back to 4.2's time:

class << ActionView::LookupContext::DetailsKey
  def clear
  end
end
@printercu

This comment has been minimized.

Show comment
Hide comment
@printercu

printercu Dec 5, 2016

Contributor

Indeed, I think it's not good idea to clear digest cache if consider_all_requests_local is enabled. Original request (#20361) was about development mode. Should I change it to if Rails.env.development??

Contributor

printercu commented Dec 5, 2016

Indeed, I think it's not good idea to clear digest cache if consider_all_requests_local is enabled. Original request (#20361) was about development mode. Should I change it to if Rails.env.development??

Show outdated Hide outdated actionview/lib/action_view/railtie.rb
Show outdated Hide outdated actionview/lib/action_view/railtie.rb
@printercu

This comment has been minimized.

Show comment
Hide comment
@printercu

printercu Dec 6, 2016

Contributor

Not sure. It just fixes this leak when ActionView::Resolver.caching? is enabled. Dev will remain untouched.

Contributor

printercu commented Dec 6, 2016

Not sure. It just fixes this leak when ActionView::Resolver.caching? is enabled. Dev will remain untouched.

Fixed usage of cache_template_loading
It disables recompilation of templates on every request in test env.

@matthewd matthewd merged commit 42b873f into rails:master Dec 7, 2016

2 checks passed

codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@printercu printercu deleted the printercu:permantent_digest_in_tests branch Dec 7, 2016

@aguynamedben

This comment has been minimized.

Show comment
Hide comment
@aguynamedben

aguynamedben Dec 12, 2016

Contributor

@printercu I don't have experience in this area of the code, but this looks sweet!!!

Contributor

aguynamedben commented Dec 12, 2016

@printercu I don't have experience in this area of the code, but this looks sweet!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment