Repository navigation
Conversation
On Windows, poll() waits with MsgWaitForMultipleObjects() and pumps window messages with PeekMessage(), TranslateMessage() and DispatchMessage(). These are the only functions git.exe imports from user32.dll, so every Git process loads user32, and with it gdi32, gdi32full, win32u and imm32, even though most commands never call poll(). Load the four functions with the existing lazyload helpers the first time poll() runs instead. If user32 cannot be loaded, the process cannot have a message queue to pump, so wait with WaitForMultipleObjects(). Signed-off-by: Alexandre Zollinger Chohfi <alzollin@microsoft.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows,
poll()incompat/poll/poll.cwaits withMsgWaitForMultipleObjects()and pumpswindow messages with
PeekMessage(),TranslateMessage()andDispatchMessage(). These are theonly functions
git.exeimports from user32.dll, so every Git process loads user32, and with itgdi32, gdi32full, win32u and imm32, even though most commands never call
poll().This loads the four functions with the existing
lazyload.hhelpers the first timepoll()runs.If user32 cannot be loaded, the process cannot have a message queue to pump, so it waits with
WaitForMultipleObjects().git.exethen maps 17 images forgit --versioninstead of 23. On a Windows 11 desktop, builtfrom v2.55.0.windows.5 with and without the change, 100 interleaved runs each:
git --versiongit rev-parse --git-dirgit status --shortgit log -1 --onelinet0061-run-command,t5400-send-packandt5601-clonepass with the change, on the release andon main.
The same code is in upstream Git, so I can send it to the mailing list too if you prefer it to go
upstream first.
I used GitHub Copilot to help investigate and prepare this change. I have reviewed and tested it.