summaryrefslogtreecommitdiff
path: root/src/chunkid.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-11-25 11:04:21 +0200
committerLars Wirzenius <liw@liw.fi>2020-11-25 11:29:47 +0200
commit4966d7e7b45d0a33af899f8c0790097509ba8be1 (patch)
tree31426161f6a0251579c0973a6902df50731664c2 /src/chunkid.rs
parent92645ef73253166296b5a6c8570729a933e55938 (diff)
downloadobnam2-4966d7e7b45d0a33af899f8c0790097509ba8be1.tar.gz
perf: store chunks on disk in a 3-level directory tree
git does the same thing. This improves the wall clock time to run benchmark-store with a million chunks from a 40.36 seconds to 18.70, on a system with NVMe and ext4.
Diffstat (limited to 'src/chunkid.rs')
-rw-r--r--src/chunkid.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/chunkid.rs b/src/chunkid.rs
index 2a38775..73e0b27 100644
--- a/src/chunkid.rs
+++ b/src/chunkid.rs
@@ -36,6 +36,10 @@ impl ChunkId {
}
}
+ pub fn as_bytes(&self) -> &[u8] {
+ self.id.as_bytes()
+ }
+
pub fn sha256(&self) -> String {
sha256(self.id.as_bytes())
}