mirror of https://github.com/restic/restic.git
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%
This commit is contained in:
parent
4cec7e236a
commit
3789e55e20
|
@ -120,9 +120,6 @@ func (idx *Index) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic.Pack
|
||||||
blobs = make([]restic.PackedBlob, 0, len(packs))
|
blobs = make([]restic.PackedBlob, 0, len(packs))
|
||||||
|
|
||||||
for _, p := range 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.PackedBlob{
|
||||||
Blob: restic.Blob{
|
Blob: restic.Blob{
|
||||||
Type: tpe,
|
Type: tpe,
|
||||||
|
@ -139,7 +136,6 @@ func (idx *Index) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic.Pack
|
||||||
return blobs, true
|
return blobs, true
|
||||||
}
|
}
|
||||||
|
|
||||||
debug.Log("id %v not found", id.Str())
|
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,17 +25,13 @@ func (mi *MasterIndex) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic
|
||||||
mi.idxMutex.RLock()
|
mi.idxMutex.RLock()
|
||||||
defer mi.idxMutex.RUnlock()
|
defer mi.idxMutex.RUnlock()
|
||||||
|
|
||||||
debug.Log("looking up id %v, tpe %v", id.Str(), tpe)
|
|
||||||
|
|
||||||
for _, idx := range mi.idx {
|
for _, idx := range mi.idx {
|
||||||
blobs, found = idx.Lookup(id, tpe)
|
blobs, found = idx.Lookup(id, tpe)
|
||||||
if found {
|
if found {
|
||||||
debug.Log("found id %v: %v", id.Str(), blobs)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug.Log("id %v not found in any index", id.Str())
|
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue