From 4966d7e7b45d0a33af899f8c0790097509ba8be1 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 25 Nov 2020 11:04:21 +0200 Subject: 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. --- src/chunkid.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/chunkid.rs') 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()) } -- cgit v1.2.1