perf(cli): use faster_hex (#22761)

`cli::util::checksum` was showing up on flame graphs because it was
concatenating allocated strings. We can use `faster-hex` to improve it.
This commit is contained in:
Matt Mastracci 2024-03-07 10:00:43 -07:00 committed by GitHub
parent 594d8397ad
commit 4791d16a8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 32 additions and 24 deletions

View file

@ -61,7 +61,7 @@ fn verify_tarball_integrity(
let mut hash_ctx = Context::new(&ring::digest::SHA1_FOR_LEGACY_USE_ONLY);
hash_ctx.update(data);
let digest = hash_ctx.finish();
let tarball_checksum = hex::encode(digest.as_ref());
let tarball_checksum = faster_hex::hex_string(digest.as_ref());
(tarball_checksum, hex)
}
NpmPackageVersionDistInfoIntegrity::UnknownIntegrity(integrity) => {