1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 05:21:16 +02:00

Speed up StorePath::to_string()

1.81% -> 0.56%
This commit is contained in:
Eelco Dolstra 2019-12-10 20:48:36 +01:00
parent f64b58b45e
commit f800d450b7
3 changed files with 24 additions and 8 deletions

View file

@ -70,7 +70,9 @@ impl StorePathHash {
impl fmt::Display for StorePathHash {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&base32::encode(&self.0))
let mut buf = vec![0; STORE_PATH_HASH_CHARS];
base32::encode_into(&self.0, &mut buf);
f.write_str(std::str::from_utf8(&buf).unwrap())
}
}