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

Function BenchmarkIntegration_SimpleQueries

pkg/sql/integration_test.go:422–451  ·  view source on GitHub ↗

BenchmarkIntegration_SimpleQueries benchmarks simple queries across all dialects

(b *testing.B)

Source from the content-addressed store, hash-verified

420
421// BenchmarkIntegration_SimpleQueries benchmarks simple queries across all dialects
422func BenchmarkIntegration_SimpleQueries(b *testing.B) {
423 projectRoot, _ := filepath.Abs(filepath.Join("..", ".."))
424 files := loadSQLTestFiles(&testing.T{}, projectRoot)
425
426 simpleFiles := []SQLTestFile{}
427 for _, file := range files {
428 if file.Complexity == "Simple" {
429 simpleFiles = append(simpleFiles, file)
430 }
431 }
432
433 if len(simpleFiles) == 0 {
434 b.Skip("No simple test files found")
435 }
436
437 b.ResetTimer()
438 for i := 0; i < b.N; i++ {
439 for _, file := range simpleFiles {
440 sqlStatement := extractSQLStatement(file.Content)
441 tkz := tokenizer.GetTokenizer()
442 tokens, _ := tkz.Tokenize([]byte(sqlStatement))
443
444 tokenizer.PutTokenizer(tkz)
445
446 p := parser.NewParser()
447 _, _ = p.ParseFromModelTokens(tokens)
448 p.Release()
449 }
450 }
451}
452
453// BenchmarkIntegration_ComplexQueries benchmarks complex queries
454func BenchmarkIntegration_ComplexQueries(b *testing.B) {

Callers

nothing calls this directly

Calls 8

ParseFromModelTokensMethod · 0.95
ReleaseMethod · 0.95
GetTokenizerFunction · 0.92
PutTokenizerFunction · 0.92
NewParserFunction · 0.92
loadSQLTestFilesFunction · 0.85
extractSQLStatementFunction · 0.85
TokenizeMethod · 0.80

Tested by

no test coverage detected