diff options
Diffstat (limited to 'internal/flatex/slice_inflate.go')
| -rw-r--r-- | internal/flatex/slice_inflate.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/flatex/slice_inflate.go b/internal/flatex/slice_inflate.go index 3e07e744..f9120143 100644 --- a/internal/flatex/slice_inflate.go +++ b/internal/flatex/slice_inflate.go @@ -3,6 +3,7 @@ package flatex import ( "io" "math/bits" + "sync" ) // sliceInflater is a specialized DEFLATE decoder that reads directly from an @@ -33,6 +34,16 @@ type sliceInflater struct { copyDist int } +var sliceInflaterPool = sync.Pool{ + New: func() any { + fixedHuffmanDecoderInit() + return &sliceInflater{ + bits: new([maxNumLit + maxNumDist]int), + codebits: new([numCodes]int), + } + }, +} + func (f *sliceInflater) reset(src []byte) error { bits := f.bits codebits := f.codebits |
