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
I/O operations on Windows tend to have the ability to "complete immediately". For example something like read_overlapped returns io::Result<bool> where Ok(false) means the operation is pending and Ok(true) means the operation completed immediately. These correspond to the underlying primitives on Windows (with various error codes).
Unfortunately, though, "completes immediately" means that by default a completion message is enqueued on the completion port. That means that if we were to service the read immediately we'd have to arrange for that later completion message to get ignored, which isn't currently easy to do. This means that although the read finished immediately we return WouldBlock and let the trip through the event loop complete the read at a later date.
As you can imagine, this seems like it can definitely be a performance hit! Thankfully Windows has an API for this, SetFileCompletionNotificationModes, which will cause a completion status to not get enqueued if an operation finishes immediately. We should use this on Windows at least for TCP/UDP read/write to help throughput.
I/O operations on Windows tend to have the ability to "complete immediately". For example something like
read_overlapped
returnsio::Result<bool>
whereOk(false)
means the operation is pending andOk(true)
means the operation completed immediately. These correspond to the underlying primitives on Windows (with various error codes).Unfortunately, though, "completes immediately" means that by default a completion message is enqueued on the completion port. That means that if we were to service the read immediately we'd have to arrange for that later completion message to get ignored, which isn't currently easy to do. This means that although the read finished immediately we return
WouldBlock
and let the trip through the event loop complete the read at a later date.As you can imagine, this seems like it can definitely be a performance hit! Thankfully Windows has an API for this,
SetFileCompletionNotificationModes
, which will cause a completion status to not get enqueued if an operation finishes immediately. We should use this on Windows at least for TCP/UDP read/write to help throughput.Some caveats:
WSARecv
implementation which libuv works around at least. I think this is only for UDP, though?The text was updated successfully, but these errors were encountered: