Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 7, 2025

profilled the src/PhpSpreadsheet/Reader/Xlsx.php case further:

we spent most of the time with merging scope objects
profile can be seen here: https://blackfire.io/profiles/0293ba31-80fc-403f-9452-bfda15b7c7c7/graph

grafik

refs #3859 (comment)

before this PR

➜  PhpSpreadsheet git:(master) ✗ hyperfine 'php ../phpstan-src/bin/phpstan analyze src/PhpSpreadsheet/Reader/Xlsx.php --debug'
Benchmark 1: php ../phpstan-src/bin/phpstan analyze src/PhpSpreadsheet/Reader/Xlsx.php --debug
  Time (mean ± σ):      8.659 s ±  0.029 s    [User: 8.479 s, System: 0.175 s]
  Range (min … max):    8.611 s …  8.701 s    10 runs

after this PR

➜  PhpSpreadsheet git:(master) ✗ hyperfine 'php ../phpstan-src/bin/phpstan analyze src/PhpSpreadsheet/Reader/Xlsx.php --debug'
Benchmark 1: php ../phpstan-src/bin/phpstan analyze src/PhpSpreadsheet/Reader/Xlsx.php --debug
  Time (mean ± σ):      7.462 s ±  0.073 s    [User: 7.294 s, System: 0.164 s]
  Range (min … max):    7.349 s …  7.550 s    10 runs

thesis: most of the time when merging scopes they contain largely identical expression. therefore optimize for the case when expressions are identical.

@ondrejmirtes ondrejmirtes merged commit dc576b9 into phpstan:2.1.x Mar 7, 2025
413 of 418 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the fast-scope-merge branch March 7, 2025 10:35
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