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 ParametersAcceptorSelector->combine() #2851

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jan 3, 2024

the repro in phpstan/phpstan#8865 (comment) gets ~25% faster after this PR

1st call is before this PR
2nd call is after this PR

➜  spryker-phpstan-issue git:(master) ✗ php ../phpstan-src/bin/phpstan analyze --memory-limit=1G -l 5 src/Pyz/Zed/CategoryDataImport/Business/QueryExpander/FooQueryExpander.php --debug -vvv

Note: Using configuration file /Users/staabm/workspace/spryker-phpstan-issue/phpstan.neon.
Result cache not used because of debug mode.
/Users/staabm/workspace/spryker-phpstan-issue/src/Pyz/Zed/CategoryDataImport/Business/QueryExpander/FooQueryExpander.php
--- consumed 132 MB, total 164 MB, took 3.17 s
Result cache was not saved because only files were passed as analysed paths.

                                                                                                                        
 [OK] No errors                                                                                                         
                                                                                                                        

Used memory: 164 MB

➜  spryker-phpstan-issue git:(master) ✗ php ../phpstan-src/bin/phpstan analyze --memory-limit=1G -l 5 src/Pyz/Zed/CategoryDataImport/Business/QueryExpander/FooQueryExpander.php --debug -vvv

Note: Using configuration file /Users/staabm/workspace/spryker-phpstan-issue/phpstan.neon.
Result cache not used because of debug mode.
/Users/staabm/workspace/spryker-phpstan-issue/src/Pyz/Zed/CategoryDataImport/Business/QueryExpander/FooQueryExpander.php
--- consumed 132 MB, total 164 MB, took 2.66 s
Result cache was not saved because only files were passed as analysed paths.

                                                                                                                        
 [OK] No errors                                                                                                         
                                                                                                                        

Used memory: 164 MB

@ondrejmirtes
Copy link
Member

Nice! Maybe this pattern (calling union in foreach instead of once) is in multiple places.

@ondrejmirtes ondrejmirtes merged commit a0d727a into phpstan:1.10.x Jan 3, 2024
409 of 424 checks passed
@staabm staabm deleted the less-union branch January 3, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants