-
-
Notifications
You must be signed in to change notification settings - Fork 381
[TwigComponent] Cache component properties metadata #2211
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
Conversation
src/TwigComponent/src/DependencyInjection/Compiler/TwigComponentPass.php
Outdated
Show resolved
Hide resolved
src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php
Outdated
Show resolved
Hide resolved
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 pretty cool! Thanks @smnandre
As an alternative, or even as a follow-up, I think it makes sense to replace/improve class Structure may look like this: |
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.
Are we agree, this is happening only in prod ? I don't see anything prod related
Hey @onEXHovia ! You read my mind This is indeed my next move, and i started to extract the props metadata from template too :) |
@WebMamba nothing "prod-related" For all the environments, during a request, there is no need to compute metadata twice, so the values are "kept". Also, if you use What's maybe missing here is something to invalidate the cache locally if you change a file ? Do you have encountered any trouble ? |
1c2fdae
to
aca73a5
Compare
aca73a5
to
0880687
Compare
0880687
to
17ebd17
Compare
17ebd17
to
049be46
Compare
049be46
to
1cc7362
Compare
Currently if we have 50 times the same component in a page, 50 times we use reflection to analyse component class properties and methods.
This PR centralize this task in a dedicated (internal) service and add a cachewarmer to pre-compute metadata during app build.
Significant performance gains here too
(i won't do charts for every PR but be sure i'm gonna make some before/after once i'm "done" with all this.... in Vienna 👼 )