Skip to content

PhpFileCleaner: Use strcspn instead of regex for fast-skip in clean()#5600

Open
staabm wants to merge 2 commits intophpstan:2.1.xfrom
staabm:fast-clean
Open

PhpFileCleaner: Use strcspn instead of regex for fast-skip in clean()#5600
staabm wants to merge 2 commits intophpstan:2.1.xfrom
staabm:fast-clean

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented May 5, 2026

applies the upstream performance optimizations from

Jordi reported a 20-25% perf increase regarding file-cleaning with this changes (see comments in referenced PRs).
I was not able to replicate the demonstrated perf benefit of the upstream PRs in a PHPStan use-case.
(I remember though that I have seen blackfire profiles in the past, which had a bottleneck on PhpFileCleaner regex-matching)
Still I think its useful to keep our copied-in code as close to the upstream as possible.

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.

1 participant