Skip to content

Commit

Permalink
opt:(ast) enlarge encode buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed Jun 26, 2024
1 parent 138dc45 commit 6766f03
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ast/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
package ast

import (
`sync`
`unicode/utf8`
)
"sync"
"unicode/utf8"

const (
_MaxBuffer = 1024 // 1KB buffer size
"github.com/bytedance/sonic/option"
)

func quoteString(e *[]byte, s string) {
Expand Down Expand Up @@ -109,7 +107,7 @@ func newBuffer() *[]byte {
if ret := bytesPool.Get(); ret != nil {
return ret.(*[]byte)
} else {
buf := make([]byte, 0, _MaxBuffer)
buf := make([]byte, 0, option.DefaultEncoderBufferSize)
return &buf
}
}
Expand Down

0 comments on commit 6766f03

Please sign in to comment.