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

Function BenchmarkParseForComparison

pkg/sql/parser/validate_test.go:99–109  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

97}
98
99func BenchmarkParseForComparison(b *testing.B) {
100 sql := "SELECT u.id, u.name, u.email FROM users u JOIN orders o ON u.id = o.user_id WHERE u.active = true AND o.total > 100 ORDER BY o.created_at DESC LIMIT 50"
101 input := []byte(sql)
102 b.ResetTimer()
103 for i := 0; i < b.N; i++ {
104 result, err := parser.ParseBytes(input)
105 if err == nil {
106 ast.ReleaseAST(result)
107 }
108 }
109}
110
111func BenchmarkParseBytes(b *testing.B) {
112 sql := []byte("SELECT u.id, u.name, u.email FROM users u JOIN orders o ON u.id = o.user_id WHERE u.active = true AND o.total > 100 ORDER BY o.created_at DESC LIMIT 50")

Callers

nothing calls this directly

Calls 2

ParseBytesFunction · 0.92
ReleaseASTFunction · 0.92

Tested by

no test coverage detected