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

Function GetTokenizer

pkg/sql/tokenizer/pool.go:94–102  ·  view source on GitHub ↗

GetTokenizer retrieves a Tokenizer instance from the pool. This is the recommended way to obtain a Tokenizer for production use. The returned tokenizer is reset and ready for use. Thread Safety: Safe for concurrent calls from multiple goroutines. Each call returns a separate instance. Memory Mana

()

Source from the content-addressed store, hash-verified

92// Performance: 95%+ hit rate means most calls reuse existing instances
93// rather than allocating new ones, providing significant performance benefits.
94func GetTokenizer() *Tokenizer {
95 t := tokenizerPool.Get().(*Tokenizer)
96
97 // Record pool metrics
98 metrics.RecordPoolGet(true) // Assume from pool (New() creates if empty)
99 metrics.RecordNamedPoolGet("tokenizer")
100
101 return t
102}
103
104// PutTokenizer returns a Tokenizer instance to the pool for reuse.
105//

Callers 15

LintStringMethod · 0.92
makeCtxFunction · 0.92
makeCtxFunction · 0.92
makeContextFunction · 0.92
testSQLFileFunction · 0.92
parseSQLFunction · 0.92

Calls 3

RecordPoolGetFunction · 0.92
RecordNamedPoolGetFunction · 0.92
GetMethod · 0.45

Tested by 15

makeCtxFunction · 0.74
makeCtxFunction · 0.74
makeContextFunction · 0.74
testSQLFileFunction · 0.74
parseSQLFunction · 0.74