mirror of https://github.com/restic/restic.git
df2c03a6a4
When looking up a blob in the master index, with several indexes present in the master index, a significant amount of time is spent generating errors for each failed lookup. However, these errors are often used to check if a blob is present, but the contents are not inspected making the overhead of the error not useful. Instead, change Index.Lookup (and Index.LookupSize) to instead return a boolean denoting if the blob was found instead of an error. Also change all the calls to these functions to handle the new function signature. benchmark old ns/op new ns/op delta BenchmarkMasterIndexLookupSingleIndex-6 820 897 +9.39% BenchmarkMasterIndexLookupMultipleIndex-6 12821 2001 -84.39% BenchmarkMasterIndexLookupSingleIndexUnknown-6 5378 492 -90.85% BenchmarkMasterIndexLookupMultipleIndexUnknown-6 17026 1649 -90.31% benchmark old allocs new allocs delta BenchmarkMasterIndexLookupSingleIndex-6 9 9 +0.00% BenchmarkMasterIndexLookupMultipleIndex-6 59 19 -67.80% BenchmarkMasterIndexLookupSingleIndexUnknown-6 22 6 -72.73% BenchmarkMasterIndexLookupMultipleIndexUnknown-6 72 16 -77.78% benchmark old bytes new bytes delta BenchmarkMasterIndexLookupSingleIndex-6 160 160 +0.00% BenchmarkMasterIndexLookupMultipleIndex-6 3200 240 -92.50% BenchmarkMasterIndexLookupSingleIndexUnknown-6 1232 48 -96.10% BenchmarkMasterIndexLookupMultipleIndexUnknown-6 4272 128 -97.00% |
||
---|---|---|
.. | ||
testdata | ||
backend.go | ||
backend_find.go | ||
backend_find_test.go | ||
blob.go | ||
blob_set.go | ||
blob_test.go | ||
buffer.go | ||
cache.go | ||
config.go | ||
config_test.go | ||
doc.go | ||
file.go | ||
file_test.go | ||
find.go | ||
find_test.go | ||
hardlinks_index.go | ||
hardlinks_index_test.go | ||
id.go | ||
id_int_test.go | ||
id_test.go | ||
ids.go | ||
ids_test.go | ||
idset.go | ||
idset_test.go | ||
lock.go | ||
lock_test.go | ||
lock_unix.go | ||
lock_windows.go | ||
node.go | ||
node_darwin.go | ||
node_freebsd.go | ||
node_linux.go | ||
node_openbsd.go | ||
node_test.go | ||
node_unix.go | ||
node_unix_test.go | ||
node_windows.go | ||
node_xattr.go | ||
progress.go | ||
progress_unix.go | ||
progress_unix_with_siginfo.go | ||
rand_reader.go | ||
readerat.go | ||
repository.go | ||
restorer.go | ||
restorer_test.go | ||
snapshot.go | ||
snapshot_find.go | ||
snapshot_policy.go | ||
snapshot_policy_test.go | ||
snapshot_test.go | ||
tag_list.go | ||
testing.go | ||
testing_test.go | ||
tree.go | ||
tree_test.go |