BenchmarkIntegration_ComplexQueries benchmarks complex queries
(b *testing.B)
| 452 | |
| 453 | // BenchmarkIntegration_ComplexQueries benchmarks complex queries |
| 454 | func 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 |
| 486 | func BenchmarkIntegration_RealWorldScenarios(b *testing.B) { |
nothing calls this directly
no test coverage detected