Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Improve Translator caching#28937
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
rpkamp commentedDec 16, 2018
Rebased and force pushed to fix merge conflict. Could I get a review here please? 🙂 |
rpkamp commentedJan 22, 2019
Rebased again. Could you have a look please@nicolas-grekas? 🙂 |
nicolas-grekas left a comment
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.
Looks good thanks. Here are some comments. Would it be possible to add some test cases also?
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
039ecd6 tod7ed632Comparerpkamp commentedMar 22, 2019
@nicolas-grekas I've rebased onto master and stopped using This prevents a full container rebuild if any of the translation directories it was tracking but did not exist is created - it will only rebuild the Catalogue in that case, which is much faster. I've also added some tests. Could you check again please? 🙂 |
rpkamp commentedMar 26, 2019
Failing tests are unrelated (I think). |
welcoMattic commentedMar 29, 2019
rpkamp commentedMar 29, 2019
This PR makes sure that catalogues also track directories that were found empty when scanning for translation files, where they didn't before. So yes, if I understand correctly this PR is also a fix for your problem,@welcoMattic 🙂 |
rpkamp commentedMar 30, 2019
Rebased on master again. This time the failed build on Travis is definitely unrelated 🙂 Ping@nicolas-grekas, could you review again please? |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
stof commentedApr 1, 2019
The list of files being loaded is still built by the container. So AFAICT, this change does not allow removing the resources at the container-level (we would still need to build the new list). |
rpkamp commentedApr 1, 2019
This change is already removing the resources from the container, and everything works fine without the container knowing where translations files reside. Why would it need to know about those? The only reason I can think of is if I add another translations path to the framework, but then the resource where I define that is not fresh anymore, so the container would be rebuilt, and the change would cascade to the catalogues. |
rpkamp commentedApr 3, 2019
Comments processed@fabpot. Could you check again please? |
curry684 commentedApr 6, 2019
Think it's right now but@fabpot should have a quick look still. |
fabpot commentedApr 6, 2019
Thank you@rpkamp. |
This PR was squashed before being merged into the 4.3-dev branch (closes#28937).Discussion----------Improve Translator caching| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#27600| License | MIT| Doc PR | N/AAdd DirectoryResources to MessageCatalogues when loaded.So that when a file is added to one of the directories the cache for all MessageCatalogues will be invalidated.All directories must be added to all MessageCatalogues because we can't predict for which locale files will be added to each individual directory.Also, now that the translator keeps track of its own directories for caching the container no longer needs to it. This means that when a translation changes or is added the container no longer needs to be fully rebuilt, saving a considerable amount of time (compilation time went down from ~4 seconds to ~1 second on each translation change/add in our project).Commits-------a524658 Improve Translator caching
curry684 commentedApr 6, 2019
@fabpot label? ;) |
fabpot commentedApr 6, 2019
@curry684 oops, fixed |
…ache for translation files (javiereguiluz)This PR was merged into the 4.3 branch.Discussion----------[Translation] Mention that you don't have to clear the cache for translation filesMentions the nice new behavior implemented insymfony/symfony#28937.Commits-------ddf97c7 [Translation] Mention that you don't have to clear the cache for translation files
Add DirectoryResources to MessageCatalogues when loaded.
So that when a file is added to one of the directories the cache for all MessageCatalogues will be invalidated.
All directories must be added to all MessageCatalogues because we can't predict for which locale files will be added to each individual directory.
Also, now that the translator keeps track of its own directories for caching the container no longer needs to it. This means that when a translation changes or is added the container no longer needs to be fully rebuilt, saving a considerable amount of time (compilation time went down from ~4 seconds to ~1 second on each translation change/add in our project).