-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
archive/zip: make checksumReader implement io.WriterTo #56742
Comments
|
Oh, I see, it is returned by |
This is a specific instance of #16474. |
Note that implementing |
You're right, of course. I had not considered this properly. Even in the very best case:
I can't imagine this being more (if at all) efficient than So perhaps the proposal should be reversed: never implement |
We've stumbled upon a case where performance is left on the table in
io.CopyBuffer
when copying from anarchive/zip.checksumReader
to an*os.File
:In this case, profiles [1] show that
buf
is unused, andio.CopyBuffer
ends up allocating in a child call. The allocations take up 8% of cycles in an exemplar of a fast compilation step (which uses an auxiliary Go binary featuring zip files) at our company.We can work around this problem now that we've discovered it using the struct hack mentioned in #16474, but this leaves performance on the table for others that copy from zip files to real files.
[1]:
The text was updated successfully, but these errors were encountered: