-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.IOenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsos-windowstenet-performancePerformance related issuePerformance related issuewishlistIssue we would like to prioritize, but we can't commit we will get to it yetIssue we would like to prioritize, but we can't commit we will get to it yet
Milestone
Description
When filling the internal buffer, Win32FileStream does this as part of ReadAsync:
Task<int> readTask = ReadInternalCoreAsync(_buffer, 0, _bufferSize, 0, cancellationToken);
_readLen = readTask.GetAwaiter().GetResult();
Ugh!
There's a large comment about how this is done to avoid concurrent use of the buffer when concurrent read operations are issued, but we should be able to work around that using something similar to what I previously did for WriteAsync and FlushAsync, with the HasActiveBufferOperation mechanism (dotnet/corefx#2929).
As it currently stands, it appears that when async reads are performed against a Win32FileStream and those reads are smaller than the file stream's buffer, all such reads will be made synchronous, either because they're pulling from the buffer or because they're blocking waiting for the buffer to be filled.
cc: @ericstj, @ianhays, @JeremyKuhne
Metadata
Metadata
Assignees
Labels
area-System.IOenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsos-windowstenet-performancePerformance related issuePerformance related issuewishlistIssue we would like to prioritize, but we can't commit we will get to it yetIssue we would like to prioritize, but we can't commit we will get to it yet