-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
AsyncExtracter
TODOs
#170
Comments
For thread-safe spsc, I found: Both provides a sync interface but should be trivial to adapt them in async by using Edit: Maybe this will be proved to be a premature optimization, so perhaps we should try the 1st TODO to adjust size of |
I am thinking about running the downloader in the same blocking thread as the extracter using This would have the following advantage:
The disadvantages would be that the downloader can no longer be run in parallel to the extracter. If the bottleneck is the decompressor, then the downloader should also pause and wait for the decompressor to consume the data. But if the bottleneck is the network, then that might be an issue. @passcod What's your thought on this? |
Alternatively, we can do:
Compared to the previous approach I proposed, this preserve the parallelism between the downloader and the extracter, while reduce the internal buffer of |
A summary of what could be/need to be improved:
Adjust the size of theCompletely remove thempsc::channel
to keep the extracter busy while avoiding reading in too much (OOM) and gives feedback to the server. Fix could be dynamically decide the buffer based onfmt: PkgFmt
since some extracters (PkgFmg::Bin
andPkgFmt::Zip
) do less work on the critical path and need bigger buffer size.mpsc
channel, runs the downloader and extracter on the same thread. Refactor and optimizefetch_crate_cratesio
#180Exploring other channels, like single-producer single-consumer thread-safe fixed-size channel, since it is likely to be much faster than mpsc which requires synchronization between producers.Most likely to be premature optimization.The aforementioned of improvement "theWe should request for the feature in upstream instead of coming up with homebrew solutionZipArchiver
can read bytes out of the file while the bytes are being appended into the file."Single-pass ZIP generation zip-rs/zip-old#16Decompress from stream zip-rs/zip-old#314extract_archive_stream
: Create a separate API forPkgFmt::Bin
. Refactor and optimizefetch_crate_cratesio
#180The text was updated successfully, but these errors were encountered: