MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / putBuffer

Function putBuffer

pkg/sql/tokenizer/pool.go:44–49  ·  view source on GitHub ↗

putBuffer returns a buffer to the pool after use. The buffer is reset (cleared) before being returned to the pool. Nil buffers are safely ignored.

(buf *bytes.Buffer)

Source from the content-addressed store, hash-verified

42// The buffer is reset (cleared) before being returned to the pool.
43// Nil buffers are safely ignored.
44func putBuffer(buf *bytes.Buffer) {
45 if buf != nil {
46 buf.Reset()
47 bufferPool.Put(buf)
48 }
49}
50
51// tokenizerPool provides object pooling for Tokenizer instances.
52// This dramatically reduces allocations in high-throughput scenarios.

Callers 3

TokenizeMethod · 0.85
TokenizeContextMethod · 0.85
BenchmarkBufferPoolFunction · 0.85

Calls 2

PutMethod · 0.80
ResetMethod · 0.45

Tested by 1

BenchmarkBufferPoolFunction · 0.68