lib/scanner: Allocate structure for final partial block (#7310)

Benchmark results on Linux/amd64, using updated benchmark for old and
new:

name        old time/op    new time/op    delta
HashFile-8    88.6ms ± 1%    88.3ms ± 1%   -0.33%  (p=0.046 n=19+19)

name        old speed      new speed      delta
HashFile-8   201MB/s ± 1%   202MB/s ± 1%   +0.33%  (p=0.044 n=19+19)

name        old alloc/op   new alloc/op   delta
HashFile-8    59.4kB ± 0%    46.1kB ± 0%  -22.47%  (p=0.000 n=14+20)

name        old allocs/op  new allocs/op  delta
HashFile-8      29.0 ± 0%      27.0 ± 0%   -6.90%  (p=0.000 n=20+20)

Co-authored-by: greatroar <@>
This commit is contained in:
greatroar
2021-01-28 14:23:24 +01:00
committed by GitHub
co-authored by greatroar <@>
parent 8b86171642
commit fbe52faf49
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -551,7 +551,7 @@ func (l testfileList) String() string {
var initOnce sync.Once
const (
testdataSize = 17 << 20
testdataSize = 17<<20 + 1
testdataName = "_random.data"
)