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

Function BenchmarkTokenize_WithContext

pkg/sql/tokenizer/context_bench_test.go:38–51  ·  view source on GitHub ↗

Benchmark tokenization with context (background)

(b *testing.B)

Source from the content-addressed store, hash-verified

36
37// Benchmark tokenization with context (background)
38func BenchmarkTokenize_WithContext(b *testing.B) {
39 sql := []byte("SELECT id, name, email, created_at FROM users WHERE active = true AND role = 'admin' ORDER BY created_at DESC LIMIT 100")
40 tkz := GetTokenizer()
41 defer PutTokenizer(tkz)
42 ctx := context.Background()
43
44 b.ResetTimer()
45 for i := 0; i < b.N; i++ {
46 _, err := tkz.TokenizeContext(ctx, sql)
47 if err != nil {
48 b.Fatalf("TokenizeContext() error = %v", err)
49 }
50 }
51}
52
53// Benchmark simple query without context
54func BenchmarkTokenize_SimpleQuery_WithoutContext(b *testing.B) {

Callers

nothing calls this directly

Calls 4

GetTokenizerFunction · 0.85
PutTokenizerFunction · 0.85
TokenizeContextMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected