Skip to content

NodeDependencies: cache normalized filenames#4815

Merged
ondrejmirtes merged 5 commits intophpstan:2.1.xfrom
staabm:norma
Jan 24, 2026
Merged

NodeDependencies: cache normalized filenames#4815
ondrejmirtes merged 5 commits intophpstan:2.1.xfrom
staabm:norma

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Jan 24, 2026

in shopware, in which we have a lot of shared traits, the same paths are over and over again normalized.

grafik

we can see FileHelper::normalizePath take ~41 seconds, from which 95% are called from NodeDependencies::getFileDependencies.


even running this PR on phpstan-src, I can see FileHelper::normalizePath dropping from 175.059 to 137.958

@ondrejmirtes
Copy link
Member

Can you experiment with having the cache in FileHelper directly?

@staabm
Copy link
Contributor Author

staabm commented Jan 24, 2026

great idea. moving the cache to FileHelper makes the number of non-cached invocations drop to 11.623 in phpstan-src

@staabm
Copy link
Contributor Author

staabm commented Jan 24, 2026

just double checked: after this PR FileHelper::normalizePath does not show up in the profile anymore

grafik

@ondrejmirtes ondrejmirtes merged commit adefcbf into phpstan:2.1.x Jan 24, 2026
629 of 639 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the norma branch January 24, 2026 16:21
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