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

Faster Scope->shouldInvalidateExpression() #2139

Merged
merged 1 commit into from Dec 21, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Dec 21, 2022

when analyzing tcpdf.php most of the time is spend in FindFirst

blackfire run --ignore-exit-status php ../phpstan-src/bin/phpstan --debug -vvv analyze tcpdf.php

grafik

speedup:

grafik

@@ -3500,6 +3500,11 @@ private function shouldInvalidateExpression(string $exprStringToInvalidate, Expr
return false;
}

// Variables will not contain traversable expression. skip the NodeFinder overhead
if ($expr instanceof Variable) {
Copy link
Member

Choose a reason for hiding this comment

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

Only if the variable name is string

Copy link
Contributor Author

@staabm staabm Dec 21, 2022

Choose a reason for hiding this comment

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

good catch. fixed and re-measured. same characteristics.. seems most variables don't reference other variables :)

@ondrejmirtes ondrejmirtes merged commit 3408a97 into phpstan:1.9.x Dec 21, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the fast-invalidate branch December 21, 2022 21:50
@williamdes
Copy link

Thank you @staabm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants