Skip to content

NameImportingPhpDocNodeVisitor: Cheap checks first#4563

Merged
samsonasik merged 3 commits intorectorphp:mainfrom
staabm:cheap-first
Jul 21, 2023
Merged

NameImportingPhpDocNodeVisitor: Cheap checks first#4563
samsonasik merged 3 commits intorectorphp:mainfrom
staabm:cheap-first

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Jul 21, 2023

shouldSkipNameForFullyQualifiedObjectType shows up in profiles, which means it is slow. lets move it after some very fast checks

@staabm staabm requested a review from TomasVotruba as a code owner July 21, 2023 08:03
return null;
}

$parentNode = $identifierTypeNode->getAttribute(PhpDocAttributeKey::PARENT);
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.

do this check earlier, as it is fast

return null;
}

if ($this->shouldImport($newNode, $identifierTypeNode, $fullyQualifiedObjectType)) {
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.

the block deleted is identical to the one after the outer IF statement

@samsonasik samsonasik merged commit d17ef04 into rectorphp:main Jul 21, 2023
@samsonasik
Copy link
Copy Markdown
Member

Thank you @staabm

@staabm staabm deleted the cheap-first branch July 21, 2023 08:24
@TomasVotruba
Copy link
Copy Markdown
Member

Thanks Markus 👏

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