-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
Large memory consumtion when extends class #4435
Comments
This bug report is missing a link to reproduction on phpstan.org. It will most likely be closed after manual review. |
To be fair, both of the files cause a similar memory footprint for me on 0.12.69:
|
Strange because i don't have the same output as you. time ./vendor/bin/phpstan analyse --debug -vvv src/LargeMemoryConsumption.php
Note: Using configuration file /home/fezfez/work/phpstan-memory/phpstan.neon.
Result cache not used because of debug mode.
/home/fezfez/work/phpstan-memory/src/LargeMemoryConsumption.php
--- consumed 210 MB, total 246 MB
Result cache was not saved because only files were passed as analysed paths.
[OK] No errors
Used memory: 246 MB
real 0m3,245s
user 0m2,700s
sys 0m0,448s
fezfez@fezfez-Inspiron-17-7779:~/work/phpstan-memory$ time ./vendor/bin/phpstan analyse --debug -vvv src/MemoryConsumptionMini.php
Note: Using configuration file /home/fezfez/work/phpstan-memory/phpstan.neon.
Result cache not used because of debug mode.
/home/fezfez/work/phpstan-memory/src/MemoryConsumptionMini.php
--- consumed 22 MB, total 58 MB
Result cache was not saved because only files were passed as analysed paths.
[OK] No errors
Used memory: 58 MB
real 0m0,473s
user 0m0,391s
sys 0m0,054s
fezfez@fezfez-Inspiron-17-7779:~/work/phpstan-memory$ composer show | grep phpstan
phpstan/phpdoc-parser 0.4.9 PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan 0.12.69 PHPStan - PHP Static Analysis Tool
fezfez@fezfez-Inspiron-17-7779:~/work/phpstan-memory$ php -v
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies Maybe it depend on php version ? |
i have added a github action to see result on a more neutral env, and indeed, result are pretty same as yours. |
i have submit an issue to shivammathur/setup-php#402 to see if i can have a complete reproduction case |
I did a very low-hanging fruit optimization for this case: phpstan/phpstan-src@d3435dd It now results in 56 MB / 110 MB consumption instead :) |
I've also seen the different consumption for each file during the development, I guess it has something to do which one you run first, how the cache is primed... |
@ondrejmirtes nice ! With the different optimizations, this are my results on my projects (2500 files ~)
Nice work ! 👍 |
Nice :) |
PHPStan 0.12.71 should be a bit better again performance and memory-wise, please test it and report back, thank you :) |
With 0.12.71 Used memory: 964.97 MB with 0.12.70 Used memory: 1.15 GB minus 600 MB since 0.12.68 for me 🌈 ! |
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. |
Bug report
Hello,
I come with another interesting case of large memory consumption when extending a class (TCPDF)
Code snippet that reproduces the problem
i made a little repository with a complete reproduction case https://github.com/fezfez/phpstan-memory
Expected output
I think class MemoryConsumptionMini and LargeMemoryConsumption should have pretty same memory usage
The text was updated successfully, but these errors were encountered: