-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Fix GH-12778: Windows IIS FastCGI Spin-Up Performance Slowdown #12784
base: master
Are you sure you want to change the base?
Conversation
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.
Sorry for the late review. I suppose other SAPIs and/or extensions could rely on the locale being set, so this is technically a BC break. I don't know whether that's the case in practice...
Wouldn't consider it late, but no worries anyway ;)
Right... Even though this call was introduced in a patch release it has been there for so long that Hyrum's law may apply... |
Master is certainly a non-issue. Release branches may be fine too, I just wanted to express the possibility of behavioral changes. FWIW the code looks correct to me, I'm ok with merging this with the very small chance of regression. We should still document this accordingly. |
The issue isn't limited to Windows only, I can also see the slowdown on my Linux machine. The cause of the slowdown is 26e4244. In that commit a locale reset routine was implemented that gets called on startup. The fix from that commit is only necessary when using readline functionality, there are three places that is used: - phpdbg - with readline_cli - readline() php function So we make sure we only reset the locale when one of these is used, preventing the overhead on normal website-serving use-cases.
Hmm. I kind of want to err on the safe side. |
Very fittingly, looks like this now fails: |
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.
Looks ok to me for master (assuming all tests get fixed...)
I figured out why that one test is failing on master but not on 8.2. The difference in the test is that on master it applies |
Actually I found https://bugs.php.net/bug.php?id=54391 now, so perhaps there is an issue with the escapeshellarg function where it should not remove characters that it can't decode but simply skip them... |
I'm afraid the whole idea of There may be valid cases for |
The issue isn't limited to Windows only (although locales on Windows are much slower so the impact is higher), I can also see the slowdown on my Linux machine. The cause of the slowdown is 26e4244. In that commit a locale reset routine was implemented that gets called on startup.
The fix from that commit is only necessary when using readline functionality, there are three places that is used:
So we make sure we only reset the locale when one of these is used, preventing the overhead on normal website-serving use-cases.
I targeted PHP 8.2 here because I find it a bit risky to put this into 8.1 as today is the last day for bugfixes...
I'm also not targeting master because it's a fix for a performance regression.