Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Dec 31, 2025

alternative implementation to #4680

degrade analysis precision to a callable type

refs phpstan/phpstan#13933


before this PR

php bin/phpstan analyze ../phpstan-performance-issue-reproduction/src/index_bad.php --debug -vvv 

Elapsed time: 16.15 seconds
Used memory: 174 MB

after this PR

php bin/phpstan analyze ../phpstan-performance-issue-reproduction/src/index_bad.php --debug -vvv 

Elapsed time: 2.24 seconds
Used memory: 90 MB

before this PR

➜  phpstan-src git:(2.1.x) ✗ time vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug13933
PHPUnit 11.5.46 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.29
Configuration: /Users/staabm/workspace/phpstan-src/phpunit.xml
Random Seed:   1767176262

.                                                                   1 / 1 (100%)

Time: 00:06.510, Memory: 92.00 MB


OK (1 test, 1 assertion)
vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filte  6.41s user 0.17s system 99% cpu 6.580 total

after this PR

➜  phpstan-src git:(2.1.x) ✗ time vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filter testBug13933
PHPUnit 11.5.46 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.29
Configuration: /Users/staabm/workspace/phpstan-src/phpunit.xml
Random Seed:   1767176352

.                                                                   1 / 1 (100%)

Time: 00:00.906, Memory: 80.50 MB

OK (1 test, 1 assertion)
vendor/bin/phpunit tests/PHPStan/Analyser/AnalyserIntegrationTest.php --filte  0.81s user 0.16s system 99% cpu 0.979 total

@staabm staabm marked this pull request as ready for review December 31, 2025 10:26
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm
Copy link
Contributor Author

staabm commented Dec 31, 2025

this PR will not close phpstan/phpstan#13933 because the reproducer was not representable (see discussion in the linked issue)

--

after rebasing this PR onto the yesterdays changes the test got 1 second slower, which is caused by d8decc8

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