Skip to content

Commit

Permalink
speedup git shallow cloning: Enable gix/max-performance
Browse files Browse the repository at this point in the history
for targets:
 - x86_64-apple-darwin
 - aarch64-apple-darwin
 - x86_64-unknown-linux-gnu
 - x86_64-unknown-linux-musl
 - aarch64-unknown-linux-gnu
 - aarch64-unknown-linux-musl

which will use `zlib-ng` to speedup decompression and use assembly
version for sha1 checksum calculation on supported CPU.

Also enable feature `zlib-ng` on windows.

Signed-off-by: Jiahao XU <[email protected]>
  • Loading branch information
NobodyXu committed Jul 6, 2023
1 parent 01a87ac commit 9341db4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ embed-resource = "2.1.1"
default = ["static", "rustls", "trust-dns", "fancy-no-backtrace", "zstd-thin", "git"]

git = ["binstalk/git"]
git-max-perf = ["binstalk/git-max-perf"]

mimalloc = ["dep:mimalloc"]

Expand Down
1 change: 1 addition & 0 deletions crates/binstalk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ windows = { version = "0.48.0", features = ["Win32_Storage_FileSystem", "Win32_F
default = ["static", "rustls", "git"]

git = ["dep:gix"]
git-max-perf = ["gix?/max-performance"]

static = ["binstalk-downloader/static"]
pkg-config = ["binstalk-downloader/pkg-config"]
Expand Down
25 changes: 23 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,30 @@ support-pkg-config := if target == target-host {
if target-os == "linux" { "true" } else { "" }
} else { "" }

enable-git-max-perf-feature := if target == "x86_64-apple-darwin" {
"true"
} else if target == "aarch64-apple-darwin" {
"true"
} else if target == "x86_64-unknown-linux-gnu" {
"true"
} else if target == "x86_64-unknown-linux-musl" {
"true"
} else if target == "aarch64-unknown-linux-gnu" {
"true"
} else if target == "aarch64-unknown-linux-musl" {
"true"
} else {
"false"
}
git-max-perf-feature := if enable-git-max-perf-feature == "true" {
",git-max-perf" + (if target-os == "windows" { ",zlib-ng" } else { "" })
} else {
""
}

cargo-features := trim_end_match(if override-features != "" { override-features
} else if (cargo-profile / ci-or-no) == "dev/ci" { "git,rustls,fancy-with-backtrace,zstd-thin,log_max_level_debug" + (if support-pkg-config != "" { ",pkg-config" } else { "" }) + extra-features
} else if (cargo-profile / ci-or-no) == "release/ci" { "git,static,rustls,trust-dns,fancy-no-backtrace,zstd-thin,log_release_max_level_debug,cross-lang-fat-lto" + extra-features
} else if (cargo-profile / ci-or-no) == "dev/ci" { "git,rustls,fancy-with-backtrace,zstd-thin,log_max_level_debug" + git-max-perf-feature + (if support-pkg-config != "" { ",pkg-config" } else { "" }) + extra-features
} else if (cargo-profile / ci-or-no) == "release/ci" { "git,static,rustls,trust-dns,fancy-no-backtrace,zstd-thin,log_release_max_level_debug,cross-lang-fat-lto" + git-max-perf-feature + extra-features
} else { extra-features
}, ",")

Expand Down

0 comments on commit 9341db4

Please sign in to comment.