You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when scraping the console in scrolling mode, winpty-agent.exe reads each line of the console using a separate ReadConsoleOutputW call. I think each call requires a context switch to conhost.exe / csrss.exe, so consolidating some of the calls might reduce CPU usage.
The OS version matters a lot here. While Windows 8 and up allow arbitrarily large reads, earlier versions of Windows do not. (In fact, with Windows 7, issuing a read of precisely the wrong size can apparently crashconhost.exe. See here for details.)
With Windows 7 and earlier, it is still possible to combine calls, but AFAIK, the console I/O is implemented using a 64KiB heap, and presumably the heap could become fragmented. Because Windows 7 can crash, I'm a little worried about reducing winpty's reliability. That said, winpty already uses a 3000-character read to find the sync marker, so perhaps reads up to that size are OK.
Doing feature detection for this issue seems hard, so maybe winpty will use GetVersionEx. MSDN lists that function as deprecated, because it's been replaced by "version helpers", but I don't think MinGW has the new APIs (even mingw-w64). I think GetVersionEx works up to Windows 8.1, though, so maybe it'll work.
The text was updated successfully, but these errors were encountered:
Currently, when scraping the console in scrolling mode,
winpty-agent.exe
reads each line of the console using a separateReadConsoleOutputW
call. I think each call requires a context switch toconhost.exe
/csrss.exe
, so consolidating some of the calls might reduce CPU usage.The OS version matters a lot here. While Windows 8 and up allow arbitrarily large reads, earlier versions of Windows do not. (In fact, with Windows 7, issuing a read of precisely the wrong size can apparently crash
conhost.exe
. See here for details.)With Windows 7 and earlier, it is still possible to combine calls, but AFAIK, the console I/O is implemented using a 64KiB heap, and presumably the heap could become fragmented. Because Windows 7 can crash, I'm a little worried about reducing winpty's reliability. That said, winpty already uses a 3000-character read to find the sync marker, so perhaps reads up to that size are OK.
Doing feature detection for this issue seems hard, so maybe winpty will use
GetVersionEx
. MSDN lists that function as deprecated, because it's been replaced by "version helpers", but I don't think MinGW has the new APIs (even mingw-w64). I thinkGetVersionEx
works up to Windows 8.1, though, so maybe it'll work.The text was updated successfully, but these errors were encountered: