-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
UIA: delay when reaching prompt with word navigation #5243
Comments
Cc @carlos-zamora. |
This could be us scanning the entire 9001-line buffer for words. @codeofdusk If you change the buffer size from 120x9001 to 120x50 (in the legacy preferences panel), does the slowdown disappear? |
Enabling "use legacy console" in properties completely disables UIA. The "buffer size" is already set to 50, should it be something else? |
Changing the buffer size from 50 to 500 has no effect. |
It looks like you've got an image with the alt text "image", what is this? |
Sorry about that. It is a screenshot of the console properties page. The window is titled, "C:\windows\system32\cmd.exe properties"; there's a tab control with "Layout" selected as the active tab. There are three frames inside the tab control:
The Screen Buffer Size frame contains the label "Width" and a disabled spinner box containing the number 111; the label "Height" and an enabled spinner box containing the number 9001; and a ticked checkbox labelled "Wrap text output on resize." There's another similar frame below Screen Buffer Size which is titled "Window Size". Since it's not the frame I am interested in, its contents are not meaningful right now. (This is a great learning experience for me, and I apologize for providing inaccessible images. 😄) |
Oh I see now. Yeah I have 9001 there. Testing. |
Yes slowdown is gone when I change it to 50. |
This is excellent news. Thank you. @carlos-zamora, I believe we chatted about this. Because conhost doesn't know where the "actual" bottom of the text is, it scans forward almost 120x9001 characters to find out that the buffer consists of nothing but spaces. This is the optimization we talked about with Michael where totally empty rows could be skipped as containing "only spaces". |
(The reason conhost doesn't know where the actual bottom of the buffer is is because a Win32 application can "address" the entire 9001 lines, even if they are not visible. It was a huge mistake to give win32 applications control over the entire buffer outside of the viewport, but it is a burden we need to live with.) |
Makes sense. Aside from that change, I’d be happy to do some more WPR traces on ConHost’s word navigation model. It’d be pretty fun actually haha |
This performs a minor refactor on `TextBuffer::MoveToNextWord` that relies more heavily on `TextBuffer::GetWordEnd`. Now, the logic is simplified and looks more like `MoveToPreviousWord`. This refactor required me to move the `lastCharPos` optimization down to `GetWordEnd`. So word expansion gets this optimization for free now. ### WPR Traces The percentages below represent the weight that a function call had. The test scenario included moving by word on the CMD welcome message until the last word was reached. Inspect.exe was used to limit any additional calls that are generally performed by a screen reader. | function | current | branch | | -- | -- | -- | | `UIA:Move` | 34.55% | 29.52% | There is an improvement of about 5% in a release build of ConHost. NOTE: `UIA::Move` already calls `Expand` after a move operation is performed. I'm using this data to represent a performance improvement across both functions. Contributes to #5243
This performs a minor refactor on `TextBuffer::MoveToNextWord` that relies more heavily on `TextBuffer::GetWordEnd`. Now, the logic is simplified and looks more like `MoveToPreviousWord`. This refactor required me to move the `lastCharPos` optimization down to `GetWordEnd`. So word expansion gets this optimization for free now. ### WPR Traces The percentages below represent the weight that a function call had. The test scenario included moving by word on the CMD welcome message until the last word was reached. Inspect.exe was used to limit any additional calls that are generally performed by a screen reader. | function | current | branch | | -- | -- | -- | | `UIA:Move` | 34.55% | 29.52% | There is an improvement of about 5% in a release build of ConHost. NOTE: `UIA::Move` already calls `Expand` after a move operation is performed. I'm using this data to represent a performance improvement across both functions. Contributes to #5243 (cherry picked from commit 386ae04)
Environment
Steps to reproduce
Expected behaviour
The prompt is quickly read.
Actual behaviour
A lag is observed before the prompt is read. A reduced lag (or none at all) is observed in Windows Terminal.
The text was updated successfully, but these errors were encountered: