vfs: only calculate one hash for reads

This speeds up mounting on the local backend enormously.
This commit is contained in:
Nick Craig-Wood 2019-11-04 10:12:56 +00:00
parent c00dcb7e67
commit be5392f448

View File

@ -45,7 +45,8 @@ func newReadFileHandle(f *File) (*ReadFileHandle, error) {
var err error var err error
o := f.getObject() o := f.getObject()
if !f.d.vfs.Opt.NoChecksum { 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 { if err != nil {
fs.Errorf(o.Fs(), "newReadFileHandle hash error: %v", err) fs.Errorf(o.Fs(), "newReadFileHandle hash error: %v", err)
} }