1
0
mirror of https://github.com/json-iterator/go.git synced 2025-03-26 21:12:40 +02:00

flush when buffer is large enough

This commit is contained in:
Tao Wen 2017-06-06 14:16:54 +08:00
parent 9e8238cdc6
commit dcb78991c4

View File

@ -164,7 +164,7 @@ func (b *Stream) Flush() error {
func (b *Stream) ensure(minimal int) {
available := b.Available()
if available < minimal {
if available < 128 {
if b.n > 1024 {
b.Flush()
}
b.growAtLeast(minimal)