-
Notifications
You must be signed in to change notification settings - Fork 194
Reduce number of read calls when not asking for progress reporting. #623
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
Reduce number of read calls when not asking for progress reporting. #623
Conversation
Also, when asking for progress reporting, cap the number of updates at approximately 100 instead of fileSize/4k.
@swift-ci test |
@@ -370,7 +369,7 @@ internal func readBytesFromFile(path inPath: PathOrURL, reportProgress: Bool, ma | |||
|
|||
localProgress?.becomeCurrent(withPendingUnitCount: Int64(fileSize)) | |||
do { | |||
let length = try readBytesFromFileDescriptor(fd, path: inPath, buffer: bytes, length: fileSize, chunkSize: size_t(preferredChunkSize), reportProgress: reportProgress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The block size is just too small (4k on macOS, e.g.), and results in a very large number of read
calls.
The linux test failure looks related:
|
@swift-ci test |
Updated to provide a "read until EOF" option, true by default. On Darwin we were always reading the requested |
LGTM! Can we merge this? |
Yah, I wanted @kperryua to take a second look if possible. |
Took me a bit to grok what the readUntilEOF change is about. I take a little issue with the name, since it presumes that the |
Fair enough - it's more like |
I like that better. |
Also, when asking for progress reporting, cap the number of updates at approximately 100 instead of fileSize/4k.