Fix repository_test.BenchmarkSaveAndEncrypt

The benchmark was actually testing the speed of index lookups.

name              old time/op    new time/op        delta
SaveAndEncrypt-8     101ns ± 2%    31505824ns ± 1%    +31311591.31%  (p=0.000 n=10+10)

name              old speed      new speed          delta
SaveAndEncrypt-8  41.7TB/s ± 2%       0.0TB/s ± 1%         -100.00%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op       delta
SaveAndEncrypt-8     1.00B ± 0%  20989508.40B ± 0%  +2098950740.00%  (p=0.000 n=10+10)

name              old allocs/op  new allocs/op      delta
SaveAndEncrypt-8      0.00             123.00 ± 0%            +Inf%  (p=0.000 n=10+9)

(The actual speed is ca. 131MiB/s.)
This commit is contained in:
greatroar 2020-06-28 17:15:26 +02:00 committed by Michael Eischer
parent 64976b1a4d
commit 02bec13ef2

View file

@ -107,8 +107,7 @@ func BenchmarkSaveAndEncrypt(t *testing.B) {
t.SetBytes(int64(size))
for i := 0; i < t.N; i++ {
// save
_, _, err = repo.SaveBlob(context.TODO(), restic.DataBlob, data, id, false)
_, _, err = repo.SaveBlob(context.TODO(), restic.DataBlob, data, id, true)
rtest.OK(t, err)
}
}