Skip to content

Faster ParametersAcceptorSelector->combine()#2851

Merged
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
staabm:less-union
Jan 3, 2024
Merged

Faster ParametersAcceptorSelector->combine()#2851
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
staabm:less-union

Conversation

@staabm
Copy link
Copy Markdown
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
Copy Markdown
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
@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

Development

Successfully merging this pull request may close these issues.

2 participants