-
Notifications
You must be signed in to change notification settings - Fork 538
Optimize path related utils on windows #2068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Type/FileTypeMapper.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this normalization below the early return, to prevent unnecessary work
src/File/FileHelper.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on windows we now take this fast path and prevent PCRE usage for regular paths starting with C:\\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other drive letters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you "ok" with allowing any uppercase character?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I feel like there has to be a better way other than comparing letters as if they were numbers :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about using ord()
? :)
to be honest, I don't like both ways. using regex would work, but we wanne be fast, right? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, another idea. now using range()
This pull request has been marked as ready for review. |
src/File/FileHelper.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other drive letters?
7f55b90
to
ea66382
Compare
e8120e9
to
da764b1
Compare
@ondrejmirtes any reasons this was not merged yet? the memory improvement is even more valuable then the time improvement IMO (less likely the process needs to go to swap) |
I think you're overthinking it - what about not checking the letter at all and just checking that 2nd and 3rd character is |
4da380c
to
ab65493
Compare
I am fine with that, too. here we go. |
Thank you! |
the changes mainly prevent excessive use of PCRE on windows. this leads to a small performance improvement of ~3%.
more suprising is blackfire reporting a 56% improvement on memory usage (830 MB instead of 1.9 GB).
tested on windows 11