Skip to content
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

Improve LocalMethodCallFinder performance #3651

Merged
merged 1 commit into from
Apr 22, 2023

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Apr 22, 2023

leads to a 86% faster analysis when running rector on a folder of the phpstan-src codebase

grafik

@@ -44,16 +44,16 @@ public function match(ClassMethod $classMethod): array
$matchingMethodCalls = [];

foreach ($methodCalls as $methodCall) {
$callerType = $this->nodeTypeResolver->getType($methodCall->var);
if (! $callerType instanceof TypeWithClassName) {
if (! $this->nodeNameResolver->isName($methodCall->name, $classMethodName)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing the cheaper check first so we don't need to resolve the type of every methodcall->var

@staabm staabm marked this pull request as ready for review April 22, 2023 15:02
@staabm
Copy link
Contributor Author

staabm commented Apr 22, 2023

the failling job is unrelated. I saw this very same error also on other PRs

@samsonasik
Copy link
Member

That probably due to new phpdoc-parser release https://github.com/phpstan/phpdoc-parser/releases/tag/1.20.1

Copy link
Member

@samsonasik samsonasik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you @staabm

@samsonasik samsonasik merged commit 6374ccd into rectorphp:main Apr 22, 2023
37 checks passed
@staabm staabm deleted the faster-finder branch April 22, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants