mirror of
https://github.com/octoleo/restic.git
synced 2025-01-05 08:02:22 +00:00
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.
This commit is contained in:
parent
367f35db27
commit
ee7c28f5e6
@ -361,7 +361,6 @@ func (arch *Archiver) Save(ctx context.Context, snPath, target string, previous
|
|||||||
switch {
|
switch {
|
||||||
case fs.IsRegularFile(fi):
|
case fs.IsRegularFile(fi):
|
||||||
debug.Log(" %v regular file", target)
|
debug.Log(" %v regular file", target)
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
// check if the file has not changed before performing a fopen operation (more expensive, specially
|
// check if the file has not changed before performing a fopen operation (more expensive, specially
|
||||||
// in network filesystems)
|
// in network filesystems)
|
||||||
@ -440,7 +439,6 @@ func (arch *Archiver) Save(ctx context.Context, snPath, target string, previous
|
|||||||
debug.Log(" %v dir", target)
|
debug.Log(" %v dir", target)
|
||||||
|
|
||||||
snItem := snPath + "/"
|
snItem := snPath + "/"
|
||||||
start := time.Now()
|
|
||||||
oldSubtree, err := arch.loadSubtree(ctx, previous)
|
oldSubtree, err := arch.loadSubtree(ctx, previous)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = arch.error(abstarget, err)
|
err = arch.error(abstarget, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user