Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[PropertyInfo] Adds static cache toPhpStanExtractor#54894
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
derrabus commentedMay 13, 2024
Please target 7.1. We usually don't merge performance improvements into LTS branches. |
src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.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.
xabbuh commentedMay 15, 2024
Shouldn't we now also implement the |
mvhirsch commentedMay 15, 2024
If so, the |
nicolas-grekas commentedMay 17, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
If all we store is class metadata, we don't need a reset IMHO as the leak is upper bounded, and resetting might effect performance of long running kernels for little memory savings in the end. |
| returnnull; | ||
| } | ||
| $nameScope =$this->contexts[$class.$declaringClass] ??=$this->nameScopeFactory->create($class,$declaringClass); |
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.
| $nameScope =$this->contexts[$class.$declaringClass] ??=$this->nameScopeFactory->create($class,$declaringClass); | |
| $nameScope =$this->contexts[$class.'/'.$declaringClass] ??=$this->nameScopeFactory->create($class,$declaringClass); |
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.
would it make sense to move this inside the loop, right before the nested foreach?:
$nameScope ??=$this->contexts[$class.'/'.$declaringClass] ??=$this->nameScopeFactory->create($class,$declaringClass);
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.
would it make sense to move this inside the loop, right before the nested foreach?:
You mean here?
Sounds reasonable to me. It may make sense to skip creating one unless really needed (and since my change is all about re-using a created one, it hardly influences performance).
src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedMay 31, 2024
Thank you@mvhirsch. |
Uh oh!
There was an error while loading.Please reload this page.
I was able to detect a performance penalty when using dozens of traits in even more classes. The
PhpStanExtractorcreates aNameScopeevery time, but afaik this can be cached like inPhpDocExtractor(see#32188).The performance impact is impressive, as it reduces the time needed for my
TestCaseby 30%. SeeBlackfire profile comparison.