Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 27, 2025

even after #4482 we still see this method call on the hot path.

grafik

running PHPStan on the PHPStan-PHPUnit extension tests show this path as the slowest part of the run:

grafik

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole issue of something called a million times could be avoided by restructuring how vendor/attributes.php looks like, so that we don't have to iterate over so many things so many times.

@staabm
Copy link
Contributor Author

staabm commented Oct 27, 2025

The whole issue of something called a million times could be avoided by restructuring how vendor/attributes.php looks like

I don't want to customize the vendor/attributes.php too much, so we stay as long as possible compatible with the upstream.
(at least not for only 5% gains).

I restructured the loops and the bootleneck no longer exists

grafik

@staabm
Copy link
Contributor Author

staabm commented Oct 27, 2025

before

➜  phpstan-phpunit git:(2.0.x) hyperfine vendor/bin/phpunit                                                                    
Benchmark 1: vendor/bin/phpunit
  Time (mean ± σ):      2.636 s ±  0.066 s    [User: 2.032 s, System: 0.183 s]
  Range (min … max):    2.556 s …  2.739 s    10 runs

with this PR

➜  phpstan-phpunit git:(2.0.x) hyperfine vendor/bin/phpunit
Benchmark 1: vendor/bin/phpunit
  Time (mean ± σ):      2.570 s ±  0.051 s    [User: 1.974 s, System: 0.180 s]
  Range (min … max):    2.451 s …  2.625 s    10 runs

@ondrejmirtes ondrejmirtes merged commit 20f2f27 into phpstan:2.1.x Oct 28, 2025
541 of 555 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the fastp branch October 28, 2025 06:33
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.

3 participants