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

Exponential time increase when evaluating large OR conditions #9690

Closed
survik1 opened this issue Jul 27, 2023 · 4 comments
Closed

Exponential time increase when evaluating large OR conditions #9690

survik1 opened this issue Jul 27, 2023 · 4 comments

Comments

@survik1
Copy link

survik1 commented Jul 27, 2023

Bug report

Since 1.10.22 PHPStan evaluating OR conditions take significantly more time, in our case it even freeze PHPStan to death, no matter how much HW we give it. The content of OR condition matters not, its just the OR condition itself.

100 OR conditions on my professional laptop take 6 min to evaluate. In version 1.10.21 it took just about 10 seconds. I am sharing a snippet with 50 conditions that crashes the playground. I had to comment some conditions as sharing was crashing too.

Code snippet that reproduces the problem

https://phpstan.org/r/e2ce161b-d483-47a1-976c-06a0a5a4fd8e

Expected output

[the analysis should had finished]

Did PHPStan help you today? Did it make you happy in any way?

No response

@mad-briller
Copy link
Contributor

bisected the issue to this commit:
phpstan/phpstan-src@989dd6f

@staabm
Copy link
Contributor

staabm commented Jul 29, 2023

as one would expect we are doing some deep recursive type resolving for the case at hand:

grafik

maybe we should give up deep inspecting expressions with a certain amount of conditions?

@ondrejmirtes
Copy link
Member

Worked around the performance problem: phpstan/phpstan-src@9adae6c

@github-actions
Copy link

github-actions bot commented Sep 9, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants