Skip to content

Commit 002a1a7

Browse files
authored
datum: remove wrong usage of pool and prealloc the buffer (#59331)
close #59332
1 parent f7759f5 commit 002a1a7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pkg/types/datum.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"sort"
2424
"strconv"
2525
"strings"
26-
"sync"
2726
"time"
2827
"unicode/utf8"
2928
"unsafe"
@@ -2431,16 +2430,11 @@ func (ds *datumsSorter) Swap(i, j int) {
24312430
ds.datums[i], ds.datums[j] = ds.datums[j], ds.datums[i]
24322431
}
24332432

2434-
var strBuilderPool = sync.Pool{New: func() any { return &strings.Builder{} }}
2435-
24362433
// DatumsToString converts several datums to formatted string.
24372434
func DatumsToString(datums []Datum, handleSpecialValue bool) (string, error) {
24382435
n := len(datums)
2439-
builder := strBuilderPool.Get().(*strings.Builder)
2440-
defer func() {
2441-
builder.Reset()
2442-
strBuilderPool.Put(builder)
2443-
}()
2436+
builder := &strings.Builder{}
2437+
builder.Grow(8 * n)
24442438
if n > 1 {
24452439
builder.WriteString("(")
24462440
}

0 commit comments

Comments
 (0)