Skip to content
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

Optimizations plus bug fix #541

Merged
merged 19 commits into from
Nov 17, 2022
Merged

Optimizations plus bug fix #541

merged 19 commits into from
Nov 17, 2022

Conversation

NobodyXu
Copy link
Member

@NobodyXu NobodyXu commented Nov 17, 2022

  • Optimize Download::and_extract: Avoid dup monomorphization
  • Increase buffer size for binstall_crates_v1 to 4096 * 5
  • Optimize opts::resolve: Avoid unnecessary clones
  • Fix reserve in opts::resolve: Do not over-reserve
  • Rename field opts::Options::resolver => resolvers
  • Refactor: Extract new type resolve::PackageInfo
    • which makes opts::resolve_inner easier to understand
    • reduce number of parameters required for download_extract_and_verify and
      collect_bin_files
    • reducing size of future returned by opts::resolve_inner by dropping
      cargo_toml::{Manifest, Package} as early as possible since
      Manifest is 3000 Bytes large while Package is 600 Bytes large.
  • Optimize fetchers::Data: Use CompactString for field name & version
    since they are usually small enough to fit in inlined version of
    CompactString.
  • Optimize gh_crate_meta: Avoid unnecessary allocation
    in RepositoryHost::get_default_pkg_url_template.
  • Refacator: Use Itertools::cartesian_product in apply_filenames_to_paths
  • Optimize ops::resolve: Avoid unnecessary clone & reduce future size
    by calling fetcher.target_meta() to obtain final metadata after
    downloaded and extracted the binaries.
  • Optimize ops::resolve: Avoid unnecessary allocation
    in download_extract_and_verify: Replace Itertools::join with
    Itertools::format to avoid allocating the string.
  • Fix disabling cargo-install fallback
  • Simplify BinFile::from_product: Takes &str instead of &Product
    since we only need product.name
  • Rename BinFile::from_product => BinFile::new
  • Refactor: Create newtype ops::resolve::Bin
    so that we don't need to unwrap() on Product::name
    and reduce memory usage.

Signed-off-by: Jiahao XU [email protected]

which makes `opts::resolve_inner` easier to understand, reduce number of
parameters required for `download_extract_and_verify` and
`collect_bin_files` and reducing size of future returned by
`opts::resolve_inner` by dropping `cargo_toml::{Manifest, Package}` as
early as possible since they are very large:

`Manifest` is 3000 Bytes large while `Package` is 600 Bytes large.

Signed-off-by: Jiahao XU <[email protected]>
since they are usually small enough to fit in inlined version of
`CompactString`.

Signed-off-by: Jiahao XU <[email protected]>
in `RepositoryHost::get_default_pkg_url_template`.

Signed-off-by: Jiahao XU <[email protected]>
by calling `fetcher.target_meta()` to obtain final metadata after
downloaded and extracted the binaries.

Signed-off-by: Jiahao XU <[email protected]>
in `download_extract_and_verify`: Replace `Itertools::join` with
`Itertools::format` to avoid allocating the string.

Signed-off-by: Jiahao XU <[email protected]>
since we only need `product.name`

Signed-off-by: Jiahao XU <[email protected]>
so that we don't need to `unwrap()` on `Product::name`.

Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu NobodyXu marked this pull request as ready for review November 17, 2022 09:26
@NobodyXu NobodyXu enabled auto-merge (squash) November 17, 2022 09:28
@NobodyXu NobodyXu requested a review from passcod November 17, 2022 09:29
@NobodyXu NobodyXu marked this pull request as draft November 17, 2022 09:36
auto-merge was automatically disabled November 17, 2022 09:36

Pull request was converted to draft

@NobodyXu NobodyXu marked this pull request as ready for review November 17, 2022 09:37
@NobodyXu NobodyXu enabled auto-merge (squash) November 17, 2022 09:38
@NobodyXu NobodyXu changed the title Optimize plus bug fix Optimizations plus bug fix Nov 17, 2022
@NobodyXu NobodyXu disabled auto-merge November 17, 2022 09:39
@NobodyXu NobodyXu enabled auto-merge (squash) November 17, 2022 09:39
Copy link
Member

@passcod passcod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

crates/binstalk/src/fetchers/gh_crate_meta/hosting.rs Outdated Show resolved Hide resolved
crates/binstalk/src/ops/resolve.rs Outdated Show resolved Hide resolved
@NobodyXu NobodyXu requested a review from passcod November 17, 2022 23:55
@NobodyXu NobodyXu merged commit 325cb5c into main Nov 17, 2022
@NobodyXu NobodyXu deleted the optimize branch November 17, 2022 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants