cargo: enable zlib-ng and fast sha1 in gix

I noticed miniz_oxide appears in perf samples. While miniz_oxide is safer, I
think zlib-ng is pretty reliable.

https://docs.rs/gix/latest/gix/#performance

libz-ng-sys is downgraded to 1.1.16 due to the Windows linking issue. The
benchmark result is obtained with libz-ng-sys 1.1.20.

https://github.com/rust-lang/libz-sys/issues/225

```
% hyperfine --sort command --warmup 3 --runs 10 -L bin jj-0,jj-1 \
  'target/release-with-debug/{bin} --ignore-working-copy log README.md'
Benchmark 1: target/release-with-debug/jj-0 ..
  Time (mean ± σ):     256.6 ms ±   4.3 ms    [User: 214.1 ms, System: 38.6 ms]
  Range (min … max):   245.4 ms … 261.2 ms    10 runs

Benchmark 2: target/release-with-debug/jj-1 ..
  Time (mean ± σ):     223.0 ms ±   4.2 ms    [User: 174.7 ms, System: 44.4 ms]
  Range (min … max):   212.4 ms … 225.8 ms    10 runs
```
This commit is contained in:
Yuya Nishihara 2024-11-20 22:07:31 +09:00
parent c0ce88003e
commit f58145b47d
3 changed files with 52 additions and 2 deletions

42
Cargo.lock generated
View File

@ -429,6 +429,15 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd0f76e066e64fdc5631e3bb46381254deab9ef1158292f27c8c57e3bf3fe59" checksum = "cbd0f76e066e64fdc5631e3bb46381254deab9ef1158292f27c8c57e3bf3fe59"
[[package]]
name = "cmake"
version = "0.1.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
version = "1.0.2" version = "1.0.2"
@ -756,6 +765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"libz-ng-sys",
"miniz_oxide 0.8.0", "miniz_oxide 0.8.0",
] ]
@ -1139,6 +1149,7 @@ dependencies = [
"once_cell", "once_cell",
"parking_lot", "parking_lot",
"prodash", "prodash",
"sha1",
"sha1_smol", "sha1_smol",
"thiserror 2.0.4", "thiserror 2.0.4",
"walkdir", "walkdir",
@ -2010,6 +2021,16 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "libz-ng-sys"
version = "1.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4436751a01da56f1277f323c80d584ffad94a3d14aecd959dd0dff75aa73a438"
dependencies = [
"cmake",
"libc",
]
[[package]] [[package]]
name = "libz-sys" name = "libz-sys"
version = "1.1.20" version = "1.1.20"
@ -2870,6 +2891,27 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "sha1"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
"sha1-asm",
]
[[package]]
name = "sha1-asm"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "286acebaf8b67c1130aedffad26f594eff0c1292389158135327d2e23aed582b"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "sha1_smol" name = "sha1_smol"
version = "1.0.1" version = "1.0.1"

View File

@ -61,7 +61,7 @@ gix = { version = "0.68.0", default-features = false, features = [
"attributes", "attributes",
"blob-diff", "blob-diff",
"index", "index",
"max-performance-safe", "max-performance",
] } ] }
glob = "0.3.1" glob = "0.3.1"
hashbrown = { version = "0.15.2", default-features = false, features = ["inline-more"] } hashbrown = { version = "0.15.2", default-features = false, features = ["inline-more"] }

View File

@ -100,8 +100,12 @@
makeWrapper makeWrapper
pkg-config pkg-config
# for libz-ng-sys (zlib-ng)
# TODO: switch to the packaged zlib-ng and drop this dependency
cmake
# for signing tests # for signing tests
gnupg gnupg
openssh openssh
] ++ linuxNativeDeps; ] ++ linuxNativeDeps;
buildInputs = with pkgs; [ buildInputs = with pkgs; [
@ -185,6 +189,10 @@
# In case you need to run `cargo run --bin gen-protos` # In case you need to run `cargo run --bin gen-protos`
protobuf protobuf
# for libz-ng-sys (zlib-ng)
# TODO: switch to the packaged zlib-ng and drop this dependency
cmake
# To run the signing tests # To run the signing tests
gnupg gnupg
openssh openssh