1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 08:16:36 +00:00

archiver/archiver: Use Index.Has() instead of Index.Lookup() in isKnownBlob

Index.Has() is a faster then Index.Lookup() for checking if a blob exists
in the index.  As the returned data is never used, this avoids a ton
of allocations.
This commit is contained in:
Matthew Dawson 2018-01-12 01:21:39 -05:00
parent df2c03a6a4
commit 3a16148447
No known key found for this signature in database
GPG key ID: 404D7F645F682028

View file

@ -86,8 +86,7 @@ func (arch *Archiver) isKnownBlob(id restic.ID, t restic.BlobType) bool {
arch.knownBlobs.Insert(id)
_, found := arch.repo.Index().Lookup(id, t)
if found {
if arch.repo.Index().Has(id, t) {
return true
}