Skip to content
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

writeBodyFixedSize: Only do an early flush if the reader is an *os.File #1674

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

Jille
Copy link
Contributor

@Jille Jille commented Dec 1, 2023

or an *io.LimitedReader of an *os.File (because that's also supported by https://cs.opensource.google/go/go/+/refs/tags/go1.21.4:src/bufio/bufio.go;l=784)

I think that having to flush less often outweighs the overhead of the extra check. The appended data is known to be large, but it might still save us a syscall by allowing it to buffer more.

or an *io.LimitedReader of an *os.File (because that's also supported by
https://cs.opensource.google/go/go/+/refs/tags/go1.21.4:src/bufio/bufio.go;l=784)

I think that having to flush less often outweighs the overhead of the
extra check. The appended data is known to be large, but it might still
save us a syscall by allowing it to buffer more.
@Jille
Copy link
Contributor Author

Jille commented Dec 1, 2023

I only ran go test, no other testing nor benchmarks.

@erikdubbelboer
Copy link
Collaborator

Where do you see that it's only useful for an os.File?

@erikdubbelboer
Copy link
Collaborator

@erikdubbelboer erikdubbelboer merged commit 0caa3b9 into valyala:master Dec 2, 2023
13 of 14 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks!

@Jille
Copy link
Contributor Author

Jille commented Dec 2, 2023

@Jille Jille deleted the less-optimistic-flushing branch December 3, 2023 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants