From 9143f35c93450272331e4160772969c7d958e41d Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sat, 15 Aug 2020 22:45:29 +0900 Subject: [PATCH] Improve encoder performance ( remove unnecessary reference ) --- encode.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/encode.go b/encode.go index 37c8b7d..376fc5d 100644 --- a/encode.go +++ b/encode.go @@ -14,7 +14,6 @@ import ( type Encoder struct { w io.Writer buf []byte - pool sync.Pool enabledIndent bool enabledHTMLEscape bool prefix []byte @@ -65,7 +64,6 @@ func init() { New: func() interface{} { return &Encoder{ buf: make([]byte, 0, bufSize), - pool: encPool, structTypeToCompiledCode: map[uintptr]*compiledCode{}, structTypeToCompiledIndentCode: map[uintptr]*compiledCode{}, } @@ -119,7 +117,7 @@ func (e *Encoder) SetIndent(prefix, indent string) { func (e *Encoder) release() { e.w = nil - e.pool.Put(e) + encPool.Put(e) } func (e *Encoder) reset() {