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

Function BenchmarkIntegration_ComplexQueries

pkg/sql/integration_test.go:454–483  ·  view source on GitHub ↗

BenchmarkIntegration_ComplexQueries benchmarks complex queries

(b *testing.B)

Source from the content-addressed store, hash-verified

452
453// BenchmarkIntegration_ComplexQueries benchmarks complex queries
454func BenchmarkIntegration_ComplexQueries(b *testing.B) {
455 projectRoot, _ := filepath.Abs(filepath.Join("..", ".."))
456 files := loadSQLTestFiles(&testing.T{}, projectRoot)
457
458 complexFiles := []SQLTestFile{}
459 for _, file := range files {
460 if file.Complexity == "Complex" {
461 complexFiles = append(complexFiles, file)
462 }
463 }
464
465 if len(complexFiles) == 0 {
466 b.Skip("No complex test files found")
467 }
468
469 b.ResetTimer()
470 for i := 0; i < b.N; i++ {
471 for _, file := range complexFiles {
472 sqlStatement := extractSQLStatement(file.Content)
473 tkz := tokenizer.GetTokenizer()
474 tokens, _ := tkz.Tokenize([]byte(sqlStatement))
475
476 tokenizer.PutTokenizer(tkz)
477
478 p := parser.NewParser()
479 _, _ = p.ParseFromModelTokens(tokens)
480 p.Release()
481 }
482 }
483}
484
485// BenchmarkIntegration_RealWorldScenarios benchmarks real-world query scenarios
486func BenchmarkIntegration_RealWorldScenarios(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