-
-
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
Refactor and optimize fetch_crate_cratesio
#180
Refactor and optimize fetch_crate_cratesio
#180
Conversation
Signed-off-by: Jiahao XU <[email protected]>
dedicated to different tasks Signed-off-by: Jiahao XU <[email protected]>
instead of `PkgFmt` Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
signature of `download_and_extract_with_filter` Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
and `download_tar_based_and_visit`. By using these two items, we avoid any I/O altogether. Everything happens in memory, thus there will be no i/o related errors or cost. This commit does not regress anything because `helpers::load_manifest_path` calls `Manifest::from_path_with_metadata`, which read in the whole `Cargo.toml` file at once. Thus this commit would not cause any OOM when the the original code would not. Signed-off-by: Jiahao XU <[email protected]>
Since mod `cretesio` is the only one need to have access to it. Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Rm unused param `path` and the unnecessary `fs::create_dir_all` since the tar will not be extracted to disk. Signed-off-by: Jiahao XU <[email protected]>
`path` Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
It wraps a `Stream<Item = Result<Bytes, E>>` and implements `Read` and `BufRead` on it so that it can be used on sync context. Signed-off-by: Jiahao XU <[email protected]>
instead of `Result<Archive, BinstallError>` Signed-off-by: Jiahao XU <[email protected]>
so that if the `io::Error` wraps a `BinstallError`, we would just unwrap it and return the inner `BinstallError`. Otherwise, just wrap the `io::Error` in a `BinstallError`. Signed-off-by: Jiahao XU <[email protected]>
This have the following advantage: - Remove the mpsc channel, which: - Remove synchronization required for mpsc. - Remove the internal buffering of the mpsc channel, which avoid potentially OOM situation. - Improve data locality since it no longer needs to be sent over thread. - It uses `block_in_place` to avoid creating an additional blocking thread. 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. Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
It was called before because `spawn_blocking` requires that, but we now switches to `block_in_place` which no longer needs this. Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Use consistent codestyle for specifing trait bounds. Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
@passcod The 2rd round of optimization is done! Now Feel free to review at anytime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superficial review only, will do a more in-depth one tonight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, wrong button.
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Avoid one `expect`. Signed-off-by: Jiahao XU <[email protected]>
I like it, but I'll do a final pass before approvinyy and merging after a sleep. |
Fixed #170 .
Refactor
extract_archive_stream
: Create separate APIs for bin, zip and other tar-based formats:extract_bin
extract_zip
extract_tar_based_stream
extract_tar_based_stream_and_visit
untar
create_tar_decoder
out ofextract_compressed_from_readable
: Nowextracter
only contains 43 lines.download_and_extract_with_filter
withdownload_tar_based_and_visit
, a more versatile solution which enablesfetch_crate_cratesio
to be completely free of disk I/O.Refactor moddrivers
and extract submodules from itfmt
forPkgFmt
and add newtypePkgFmtDecomposed
andTarBasedFmt
.Optimize
fetch_crate_cratesio
to remove all disk I/O.async_extracter
now only contains 129 lines and it does not create blocking threads anymore, which has significant overhead.Added