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

Function BenchmarkIntegration_RealWorldScenarios

pkg/sql/integration_test.go:486–515  ·  view source on GitHub ↗

BenchmarkIntegration_RealWorldScenarios benchmarks real-world query scenarios

(b *testing.B)

Source from the content-addressed store, hash-verified

484
485// BenchmarkIntegration_RealWorldScenarios benchmarks real-world query scenarios
486func BenchmarkIntegration_RealWorldScenarios(b *testing.B) {
487 projectRoot, _ := filepath.Abs(filepath.Join("..", ".."))
488 files := loadSQLTestFiles(&testing.T{}, projectRoot)
489
490 realWorldFiles := []SQLTestFile{}
491 for _, file := range files {
492 if file.Dialect == "real_world" {
493 realWorldFiles = append(realWorldFiles, file)
494 }
495 }
496
497 if len(realWorldFiles) == 0 {
498 b.Skip("No real-world test files found")
499 }
500
501 b.ResetTimer()
502 for i := 0; i < b.N; i++ {
503 for _, file := range realWorldFiles {
504 sqlStatement := extractSQLStatement(file.Content)
505 tkz := tokenizer.GetTokenizer()
506 tokens, _ := tkz.Tokenize([]byte(sqlStatement))
507
508 tokenizer.PutTokenizer(tkz)
509
510 p := parser.NewParser()
511 _, _ = p.ParseFromModelTokens(tokens)
512 p.Release()
513 }
514 }
515}

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