-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix performance regression with empty template rendering #1544
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
Fix performance regression with empty template rendering #1544
Conversation
Closes rspec#1537. The change in 80637fc introduced a performance regression because the template lookup cache was being lost every time an example was run. This commit fixes the problem by caching the EmptyTemplateResolver instances between example runs in a hash indexed by the path string.
Can we add a benchmark for this? Before / After? That's what we'd normally do for this sort of thing... :) |
@JonRowe commit a benchmark test to the repo? |
I meant to |
NOTE: all tests carried out using the sample application in #1537 e52281c (v3.4.0)
cf97d15 (v3.4.1)
As you can see the tests take three times as long to run which is due to the extra file stats carried out whilst searching for the template. In 3.4.0 that template search is cached whereas 3.4.1 it isn't because we're creating a new resolver instance for every example run. Caching the resolver instances gives the following improvement:
This actually now gives a slightly improved performance over 3.4.0. |
Fix performance regression with empty template rendering
Thanks :) |
Fix performance regression with empty template rendering
Will we cut a release for this? |
Sure, why not, done. |
👍 |
Closes #1537.
The change in 80637fc introduced a performance regression because the template lookup cache was being lost every time an example was run.
This commit fixes the problem by caching the EmptyTemplateResolver instances between example runs in a hash indexed by the path string.