Skip to content

archive/zip: support zero-copy writing #73404

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

Open
hanwen-flow opened this issue Apr 16, 2025 · 4 comments
Open

archive/zip: support zero-copy writing #73404

hanwen-flow opened this issue Apr 16, 2025 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Milestone

Comments

@hanwen-flow
Copy link

hanwen-flow commented Apr 16, 2025

Proposal Details

The fileWriter returned by CreateRaw does not do any
checksumming. Hence, we can bypass userspace for the copying if the
source is another file.

We don't have to add new methods/functions, but simply add ReadFrom to the io.Writer returned by CreateRaw.

Sample implementation in https://go-review.googlesource.com/c/go/+/665596

@gopherbot gopherbot added this to the Proposal milestone Apr 16, 2025
@hanwen-flow
Copy link
Author

hanwen-flow commented Apr 16, 2025

The other direction (reading a zip file with zero copy) is enabled by #73399, but can also easily be coded outside of the zip package by seeking to zip.File.DataOffset() and then using a io.LimitedReader.

@gabyhelp
Copy link

Related Issues

Related Code Changes

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gabyhelp gabyhelp added the LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool label Apr 16, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/665596 mentions this issue: archive/zip: support zero-copy for CreateRaw

@seankhliao
Copy link
Member

With no api change, i don't think this needs to be a proposal

@seankhliao seankhliao changed the title proposal: archive/zip: support zero-copy writing archive/zip: support zero-copy writing Apr 16, 2025
@seankhliao seankhliao added Performance NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed Proposal LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool labels Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Projects
None yet
Development

No branches or pull requests

4 participants