From be5392f4488d7e994f2b2a44794642eb9144605f Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 4 Nov 2019 10:12:56 +0000 Subject: [PATCH] vfs: only calculate one hash for reads This speeds up mounting on the local backend enormously. --- vfs/read.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vfs/read.go b/vfs/read.go index cd65f0e08..4f2cac54d 100644 --- a/vfs/read.go +++ b/vfs/read.go @@ -45,7 +45,8 @@ func newReadFileHandle(f *File) (*ReadFileHandle, error) { var err error o := f.getObject() if !f.d.vfs.Opt.NoChecksum { - mhash, err = hash.NewMultiHasherTypes(o.Fs().Hashes()) + hashes := hash.NewHashSet(o.Fs().Hashes().GetOne()) // just pick one hash + mhash, err = hash.NewMultiHasherTypes(hashes) if err != nil { fs.Errorf(o.Fs(), "newReadFileHandle hash error: %v", err) }