Optimize path related utils on windows#2068
Conversation
src/Type/FileTypeMapper.php
Outdated
There was a problem hiding this comment.
moved this normalization below the early return, to prevent unnecessary work
src/File/FileHelper.php
Outdated
There was a problem hiding this comment.
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.
What about other drive letters?
There was a problem hiding this comment.
are you "ok" with allowing any uppercase character?
There was a problem hiding this comment.
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.
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.
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.
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