From 3789e55e20b3234b85de2172ea5e6ef75c3e6946 Mon Sep 17 00:00:00 2001 From: Matthew Dawson Date: Sun, 21 Jan 2018 23:26:24 -0500 Subject: [PATCH] repostiory/index: Remove logging from Lookup function. The logging in these functions double the time they take to execute. However, it is only really useful on failures, which are better reported by the calling functions. benchmark old ns/op new ns/op delta BenchmarkMasterIndexLookupSingleIndex-6 897 395 -55.96% BenchmarkMasterIndexLookupMultipleIndex-6 2001 1090 -45.53% BenchmarkMasterIndexLookupSingleIndexUnknown-6 492 215 -56.30% BenchmarkMasterIndexLookupMultipleIndexUnknown-6 1649 912 -44.69% benchmark old allocs new allocs delta BenchmarkMasterIndexLookupSingleIndex-6 9 1 -88.89% BenchmarkMasterIndexLookupMultipleIndex-6 19 1 -94.74% BenchmarkMasterIndexLookupSingleIndexUnknown-6 6 0 -100.00% BenchmarkMasterIndexLookupMultipleIndexUnknown-6 16 0 -100.00% benchmark old bytes new bytes delta BenchmarkMasterIndexLookupSingleIndex-6 160 96 -40.00% BenchmarkMasterIndexLookupMultipleIndex-6 240 96 -60.00% BenchmarkMasterIndexLookupSingleIndexUnknown-6 48 0 -100.00% BenchmarkMasterIndexLookupMultipleIndexUnknown-6 128 0 -100.00% --- internal/repository/index.go | 4 ---- internal/repository/master_index.go | 4 ---- 2 files changed, 8 deletions(-) diff --git a/internal/repository/index.go b/internal/repository/index.go index 7da96955a..b9ed9cf98 100644 --- a/internal/repository/index.go +++ b/internal/repository/index.go @@ -120,9 +120,6 @@ func (idx *Index) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic.Pack blobs = make([]restic.PackedBlob, 0, len(packs)) for _, p := range packs { - debug.Log("id %v found in pack %v at %d, length %d", - id.Str(), p.packID.Str(), p.offset, p.length) - blob := restic.PackedBlob{ Blob: restic.Blob{ Type: tpe, @@ -139,7 +136,6 @@ func (idx *Index) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic.Pack return blobs, true } - debug.Log("id %v not found", id.Str()) return nil, false } diff --git a/internal/repository/master_index.go b/internal/repository/master_index.go index 4c41e8ba2..02a27d5d1 100644 --- a/internal/repository/master_index.go +++ b/internal/repository/master_index.go @@ -25,17 +25,13 @@ func (mi *MasterIndex) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic mi.idxMutex.RLock() defer mi.idxMutex.RUnlock() - debug.Log("looking up id %v, tpe %v", id.Str(), tpe) - for _, idx := range mi.idx { blobs, found = idx.Lookup(id, tpe) if found { - debug.Log("found id %v: %v", id.Str(), blobs) return } } - debug.Log("id %v not found in any index", id.Str()) return nil, false }