This repository was archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 202
prototype async API, with demonstrable perf improvements via benchmark #409
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d81365e
to
1cf3fb9
Compare
764efe5
to
68e7ec1
Compare
68e7ec1
to
35c04c7
Compare
8cfde92
to
aea5359
Compare
36a62c7
to
87f21bb
Compare
This reverts commit 1da7060.
Replaced with zip-rs/zip2#73. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another response to zip-rs/zip2#165.
After demonstrating an approach to parallelize extracting zip archives using rayon threadpools in #407, I wanted to further investigate whether introducing an
async
API might provide a more scalable approach to introducing parallelism (as I noted in https://github.com/zip-rs/zip/issues/403#issuecomment-1728747153). This PR prototypes such an API.Example Usage
See the doctest: https://github.com/zip-rs/zip/blob/bc601d744bf8f61cb3eda88d39610de55098b120/src/read/tokio.rs#L554-L576
Performance & Benchmarking
cargo bench -- io demonstrates that this async implementation is faster to extract for large archives!
Notably, this approach is already faster than the sync implementation, without even applying the optimizations requiring a cloneable file handle that were necessary in #407!
TODO
This is left as a draft because it adds a lot of extra dependencies, which I would like to avoid. It also directly depends on
tokio
, instead of using theasync-executors
crate to apply to any async executor. I'm going to spend some time to break out the extra code I had to write to make this async API work into a separate wrapper crate, which should allow this change to become much smaller and easier for maintainers to accept.