2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-03 01:20:49 +00:00
restic/cmd/restic
Matthew Dawson df2c03a6a4
repository/master_index: Optimize Index.Lookup()
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%
2018-01-23 22:25:56 -05:00
..
testdata Moves files 2017-07-23 14:19:13 +02:00
.gitignore Moves files 2017-07-23 14:19:13 +02:00
background_linux.go Run goimports 2017-07-23 14:21:03 +02:00
background.go Moves files 2017-07-23 14:19:13 +02:00
cleanup.go Remove SuspendSignalHandler 2018-01-17 23:14:47 +01:00
cmd_backup.go backup: Reject filenames with paths read from stdin 2017-12-13 19:55:53 +01:00
cmd_cat.go repository/master_index: Optimize Index.Lookup() 2018-01-23 22:25:56 -05:00
cmd_check.go use global context for check, debug, dump, find, forget, init, key, 2017-12-06 07:02:55 -05:00
cmd_debug.go use global context for check, debug, dump, find, forget, init, key, 2017-12-06 07:02:55 -05:00
cmd_diff.go repository/master_index: Optimize Index.Lookup() 2018-01-23 22:25:56 -05:00
cmd_dump.go repository/master_index: Optimize Index.Lookup() 2018-01-23 22:25:56 -05:00
cmd_find.go Correct golint warning on return 2017-12-26 17:09:41 -05:00
cmd_forget.go forget: Also run prune when only IDs are forgotten 2018-01-01 21:27:40 +01:00
cmd_generate.go Rework generation of manpages and completion files 2017-09-26 13:12:12 +02:00
cmd_init.go init: Correct text (backend vs. repository) 2018-01-20 09:51:49 +01:00
cmd_key.go use global context for check, debug, dump, find, forget, init, key, 2017-12-06 07:02:55 -05:00
cmd_list.go use global context for check, debug, dump, find, forget, init, key, 2017-12-06 07:02:55 -05:00
cmd_ls.go use global context for cat and ls 2017-12-06 05:48:39 -05:00
cmd_migrate.go Capitalize short help commands 2017-09-11 09:32:44 -07:00
cmd_mount.go fuse/mount: Add option for snapshot template 2018-01-15 14:47:17 +01:00
cmd_options.go Capitalize short help commands 2017-09-11 09:32:44 -07:00
cmd_prune.go prune: Repack mixed pack files 2017-09-24 21:54:53 +02:00
cmd_rebuild_index.go fix #1411 2017-11-19 11:40:47 +01:00
cmd_restore.go restore: Improve error message for more than one ID 2018-01-06 22:44:18 +01:00
cmd_snapshots.go Add --last flag to snapshots command 2017-10-26 14:02:29 +08:00
cmd_tag.go use global context for check, debug, dump, find, forget, init, key, 2017-12-06 07:02:55 -05:00
cmd_unlock.go use global context for check, debug, dump, find, forget, init, key, 2017-12-06 07:02:55 -05:00
cmd_version.go Capitalize short help commands 2017-09-11 09:32:44 -07:00
doc.go Moves files 2017-07-23 14:19:13 +02:00
exclude_test.go Document approach for multiple reject-if-present test 2017-11-27 21:38:15 +01:00
exclude.go cmd/restic: Use a dedicated cache for each rejectIfPresent 2017-11-27 17:33:53 +01:00
excludes Upadte vendored dependencies 2017-10-22 10:07:36 +02:00
find.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
flags_test.go Moves files 2017-07-23 14:19:13 +02:00
format.go Correctly format all node types 2017-12-03 17:38:55 +01:00
global_debug.go debug: properly handle interrupted profiles 2017-08-28 22:03:26 -07:00
global_release.go debug: properly handle interrupted profiles 2017-08-28 22:03:26 -07:00
global.go Remove SuspendSignalHandler 2018-01-17 23:14:47 +01:00
integration_fuse_test.go fuse/mount: Add option for snapshot template 2018-01-15 14:47:17 +01:00
integration_helpers_test.go Fix test failing on OpenBSD #1307 2017-11-05 07:27:58 +01:00
integration_helpers_unix_test.go Moves files 2017-07-23 14:19:13 +02:00
integration_helpers_windows_test.go Moves files 2017-07-23 14:19:13 +02:00
integration_test.go fix #1143 2017-10-05 11:48:26 -07:00
local_layout_test.go Remove all dot-imports 2017-10-02 15:06:39 +02:00
lock.go Improve error message when creating lock failed 2017-10-14 15:56:25 +02:00
main.go Capitalize short help commands 2017-09-11 09:32:44 -07:00
table.go Show the amount of snapshots 2017-10-01 17:14:54 +02:00