mirror of
https://github.com/restic/restic.git
synced 2026-08-13 09:03:17 +00:00
Make decryptReader fulfill flate.Reader
benchmark old ns/op new ns/op delta
BenchmarkLoadJSONID 50232171 48596972 -3.26%
benchmark old allocs new allocs delta
BenchmarkLoadJSONID 43643 42884 -1.74%
benchmark old bytes new bytes delta
BenchmarkLoadJSONID 5773048 3785517 -34.43%
This commit is contained in:
@@ -2,6 +2,7 @@ package restic
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/flate"
|
||||
"compress/zlib"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
@@ -146,8 +147,10 @@ func (s Server) LoadJSONID(t backend.Type, storageID backend.ID, item interface{
|
||||
}
|
||||
|
||||
// unzip
|
||||
br := decryptRd.(flate.Reader)
|
||||
|
||||
unzipRd := zReaderPool.Get().(zReader)
|
||||
err = unzipRd.Reset(decryptRd, nil)
|
||||
err = unzipRd.Reset(br, nil)
|
||||
defer func() {
|
||||
unzipRd.Close()
|
||||
zReaderPool.Put(unzipRd)
|
||||
|
||||
Reference in New Issue
Block a user