Benchmark tokenization with context (background)
(b *testing.B)
| 36 | |
| 37 | // Benchmark tokenization with context (background) |
| 38 | func 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 |
| 54 | func BenchmarkTokenize_SimpleQuery_WithoutContext(b *testing.B) { |
nothing calls this directly
no test coverage detected