From ee7c28f5e67c9c2c48b830f55f664e50de81be7a Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 21 Oct 2022 20:54:58 +0200 Subject: [PATCH] backup: reduce calls to time.Now Archiver.Save queries the current time multiple times. This commit removes one of these calls as they showed up while profiling a backup of a nearly unchanged dataset containing 3 million files. --- internal/archiver/archiver.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/archiver/archiver.go b/internal/archiver/archiver.go index 23ff14a26..dda86c11e 100644 --- a/internal/archiver/archiver.go +++ b/internal/archiver/archiver.go @@ -361,7 +361,6 @@ func (arch *Archiver) Save(ctx context.Context, snPath, target string, previous switch { case fs.IsRegularFile(fi): debug.Log(" %v regular file", target) - start := time.Now() // check if the file has not changed before performing a fopen operation (more expensive, specially // in network filesystems) @@ -440,7 +439,6 @@ func (arch *Archiver) Save(ctx context.Context, snPath, target string, previous debug.Log(" %v dir", target) snItem := snPath + "/" - start := time.Now() oldSubtree, err := arch.loadSubtree(ctx, previous) if err != nil { err = arch.error(abstarget, err)