Skip to content

Improve LocalMethodCallFinder performance#3651

Merged
samsonasik merged 1 commit intorectorphp:mainfrom
staabm:faster-finder
Apr 22, 2023
Merged

Improve LocalMethodCallFinder performance#3651
samsonasik merged 1 commit intorectorphp:mainfrom
staabm:faster-finder

Conversation

@staabm
Copy link
Copy Markdown
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

foreach ($methodCalls as $methodCall) {
$callerType = $this->nodeTypeResolver->getType($methodCall->var);
if (! $callerType instanceof TypeWithClassName) {
if (! $this->nodeNameResolver->isName($methodCall->name, $classMethodName)) {
Copy link
Copy Markdown
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 staabm requested a review from TomasVotruba as a code owner April 22, 2023 15:02
@staabm
Copy link
Copy Markdown
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
Copy Markdown
Member

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

Copy link
Copy Markdown
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
@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

Development

Successfully merging this pull request may close these issues.

2 participants