Further performance improvements
Further removed multiple pointer instances Re-use decompression readers (except zstd due to bugs)
This commit is contained in:
@@ -1,19 +1,16 @@
|
||||
package decompress
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"github.com/klauspost/compress/zstd"
|
||||
)
|
||||
|
||||
type Zstd struct{}
|
||||
|
||||
func (z Zstd) Decompress(data []byte) ([]byte, error) {
|
||||
rdr, err := zstd.NewReader(bytes.NewReader(data))
|
||||
rdr, err := zstd.NewReader(nil, zstd.WithDecoderLowmem(true), zstd.WithDecoderConcurrency(1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rdr.Close()
|
||||
return io.ReadAll(rdr)
|
||||
return rdr.DecodeAll(data, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user