feat(tvix/store/digests): use bytes::Bytes instead of Vec<u8>
This will save us some copies, because a clone will simply create an additional pointer to the same data. Change-Id: I017a5d6b4c85a861b5541ebad2858ad4fbf8e8fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/8978 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
72e82ffcb1
commit
a6580748aa
14 changed files with 99 additions and 68 deletions
|
|
@ -247,12 +247,11 @@ impl Directory {
|
|||
pub fn digest(&self) -> B3Digest {
|
||||
let mut hasher = blake3::Hasher::new();
|
||||
|
||||
let vec = hasher
|
||||
hasher
|
||||
.update(&self.encode_to_vec())
|
||||
.finalize()
|
||||
.as_bytes()
|
||||
.to_vec();
|
||||
B3Digest::from_vec(vec).unwrap()
|
||||
.into()
|
||||
}
|
||||
|
||||
/// validate checks the directory for invalid data, such as:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue