From 94a6325ee646be4a06ca0646fcd797b2a9c74581 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 25 Nov 2025 08:00:00 +0800 Subject: flatex: Restructure a little --- internal/flatex/slice_inflate.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'internal/flatex/slice_inflate.go') 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 -- cgit v1.3.1-10-gc9f91