chunkedreader: disable hash calculation for first segment
This will produce a slight speedup for small files.
This commit is contained in:
parent
6150ae89d6
commit
c00dcb7e67
1 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
|
"github.com/rclone/rclone/fs/hash"
|
||||||
)
|
)
|
||||||
|
|
||||||
// io related errors returned by ChunkedReader
|
// io related errors returned by ChunkedReader
|
||||||
|
@ -215,12 +216,12 @@ func (cr *ChunkedReader) openRange() error {
|
||||||
var err error
|
var err error
|
||||||
if length <= 0 {
|
if length <= 0 {
|
||||||
if offset == 0 {
|
if offset == 0 {
|
||||||
rc, err = cr.o.Open(cr.ctx)
|
rc, err = cr.o.Open(cr.ctx, &fs.HashesOption{Hashes: hash.Set(hash.None)})
|
||||||
} else {
|
} else {
|
||||||
rc, err = cr.o.Open(cr.ctx, &fs.RangeOption{Start: offset, End: -1})
|
rc, err = cr.o.Open(cr.ctx, &fs.HashesOption{Hashes: hash.Set(hash.None)}, &fs.RangeOption{Start: offset, End: -1})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc, err = cr.o.Open(cr.ctx, &fs.RangeOption{Start: offset, End: offset + length - 1})
|
rc, err = cr.o.Open(cr.ctx, &fs.HashesOption{Hashes: hash.Set(hash.None)}, &fs.RangeOption{Start: offset, End: offset + length - 1})
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue