From c1689192d9e431a063ee89ca1c18b723bbdc970d Mon Sep 17 00:00:00 2001 From: Gabriel Goller Date: Wed, 3 Jul 2024 17:08:36 +0200 Subject: [PATCH] datastore: use cached snapshot time string in path When getting the `full_path` of a snapshot we did not use the cached time string. By using it we avoid a call to the super-slow libc strftime. This has some minor performance improvements of circa 7%. That is ~100ms on my datastore with ~5000 snapshots. Signed-off-by: Gabriel Goller --- pbs-datastore/src/backup_info.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs index bdfaeabc..414ec878 100644 --- a/pbs-datastore/src/backup_info.rs +++ b/pbs-datastore/src/backup_info.rs @@ -415,7 +415,9 @@ impl BackupDir { /// Returns the absolute path for backup_dir, using the cached formatted time string. pub fn full_path(&self) -> PathBuf { - self.store.snapshot_path(&self.ns, &self.dir) + let mut path = self.store.base_path(); + path.push(self.relative_path()); + path } pub fn protected_file(&self) -> PathBuf {