Skip to content

DynamicReturnTypeExtensionRegistry: Cache extension-class-names - #6203

Merged
staabm merged 2 commits into
phpstan:2.2.xfrom
staabm:rsrc
Aug 10, 2026
Merged

DynamicReturnTypeExtensionRegistry: Cache extension-class-names#6203
staabm merged 2 commits into
phpstan:2.2.xfrom
staabm:rsrc

Conversation

@staabm

@staabm staabm commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

/Users/staabm/workspace/phpstan-src/bin/phpstan analyze -vvv --debug /Users/staabm/workspace/shopware/src/Core/Framework/DependencyInjection/Configuration.php on shopware/shopware@5010d1c

before this PR:
3,5s 190.5 MB

after this PR:
2,7s 188.5 MB


prevents expensive repetetive calls to getParentClass()/getParentClassNames()

grafik

@staabm
staabm marked this pull request as ready for review August 10, 2026 11:05
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@staabm

staabm commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

we have a similar code in

foreach (array_merge([$className], $class->getParentClassesNames(), $class->getNativeReflection()->getInterfaceNames()) as $extensionClassName) {

and
foreach (array_merge([$referencedClass], $classReflection->getParentClassesNames(), $classReflection->getNativeReflection()->getInterfaceNames()) as $className) {

but I did not yet have evidence this is similar slow.

@staabm
staabm merged commit 8e90347 into phpstan:2.2.x Aug 10, 2026
755 of 757 checks passed
@staabm
staabm deleted the rsrc branch August 10, 2026 11:48
@ondrejmirtes

Copy link
Copy Markdown
Member

Also in LazyRegistry and Collectors\Registry.

@staabm

staabm commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

LazyRegistry and Collectors\Registry.

those depend on runtime reflection, while the other ones depend on static reflection.

should I switch them to make use of ReflectionProvider?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants