Performance Benchmarks
Parse-stage performance of the GoSQLX parser, re-measured with the in-repo benchmarks.
Measured 2026-10-22 · Apple M4 · Go 1.27 · parse stage only
Parse Benchmarks
Parse-stage throughput (Apple M4, Go 1.27)
Measured on Apple M4 · Go 1.27 · parse stage · median of 10 runs · 2026-10-22 · source BenchmarkPerformanceBaseline. Reproduce
Competitor Comparison
End-to-end stage (SQL text to AST) · AMD EPYC 9V74 80-Core Processor (linux/amd64) · go1.26.9 · median of 10 runs · measured 2026-10-22 · commit e9c5db9
| Query | GoSQLX | pg_query_go | Vitess sqlparser | TiDB parser | xwb1989/sqlparser |
|---|---|---|---|---|---|
| Simple SELECT | 2,138 ns | 10,811 ns | 1,587 ns | 2,801 ns | 7,897 ns |
| SELECT with WHERE, ORDER BY, LIMIT | 4,439 ns | 32,990 ns | 3,626 ns | 7,218 ns | 11,826 ns |
| Two-table JOIN | 6,919 ns | 43,528 ns | 4,700 ns | 8,535 ns | 25,931 ns |
| GROUP BY with HAVING | 4,818 ns | 25,832 ns | 3,090 ns | 6,572 ns | 12,192 ns |
| IN subquery | 4,076 ns | 23,527 ns | 3,977 ns | 6,279 ns | 21,828 ns |
| Common table expression | 5,829 ns | 33,530 ns | 4,415 ns | 9,158 ns | not supported |
| Window function | 4,062 ns | 21,010 ns | 3,903 ns | 6,022 ns | not supported |
| Multi-JOIN analytical query | 18,293 ns | 116,213 ns | 12,305 ns | 21,303 ns | 42,654 ns |
| INSERT VALUES | 3,185 ns | 13,373 ns | 2,202 ns | 3,914 ns | 9,105 ns |
| UPDATE with WHERE | 2,641 ns | 14,108 ns | 2,044 ns | 3,922 ns | 9,033 ns |
| DELETE with WHERE | 1,772 ns | 8,876 ns | 1,343 ns | 2,312 ns | 6,736 ns |
Median ns per statement; lower is faster and the fastest library per query is in bold. Hover a query name to see its SQL.
← Swipe to see all columns →
Read with care. The libraries implement different SQL dialects and build different ASTs (pg_query_go wraps the real PostgreSQL parser through CGo and converts its tree to Go structs; Vitess, TiDB and xwb1989 implement MySQL grammars). Each figure is the end-to-end cost of turning the same SQL text into that library's AST on the stated hardware, not identical work.
- GoSQLX:
github.com/ajitpratap0/GoSQLXcommit e9c5db91a8ed · multi-dialect (default settings) - pg_query_go:
github.com/pganalyze/pg_query_go/v6v6.2.5 · PostgreSQL (the real PostgreSQL grammar via CGo) - Vitess sqlparser:
vitess.io/vitessv0.24.5 · MySQL - TiDB parser:
github.com/pingcap/tidb/pkg/parserv0.0.0-20261015143638-7193401b6746 · MySQL (TiDB) - xwb1989/sqlparser:
github.com/xwb1989/sqlparserv0.0.0-20180606152119-120387863bf2 · MySQL (2018 Vitess fork, unmaintained)
Reproduce with task bench:publish using the benchmark harness, which pins every library version and keeps the raw output for benchstat. See also the feature comparison.
Reproduce these numbers
Clone the repository, then run the commands below. Absolute numbers depend on your hardware; compare ratios, not raw ns/op.
Parse stage (the charts above)
go test -run='^$' -bench=BenchmarkPerformanceBaseline -benchmem -count=20 ./pkg/sql/parser/Summarise the 10 runs with benchstat to get the median.
Competitor comparison (end-to-end)
cd benchmarks/compare && go test -run=^$ -bench=^BenchmarkParse$ -benchmem -count=10 .Needs CGO for pg_query_go. Summarise with benchstat; `task bench:publish` runs this and writes results/latest.json and latest.txt.
CI regression check (not a measurement)
go test -run TestPerformanceRegression ./pkg/sql/parser/Compares against the loose ceilings in the baselines file; skipped under the race detector.
- Parse benchmark source:
pkg/sql/parser/performance_regression_test.go - CI baselines:
performance_baselines.json - Competitor harness:
benchmarks/compare - CI runs: Competitor Benchmarks workflow
Methodology
- Go 1.27 on Apple M4 (arm64); every figure is for the parse stage only (pre-tokenized input to AST), not tokenize or end-to-end
- Source: BenchmarkPerformanceBaseline, median of 20 runs, re-measured 2026-10-22, run with
-benchmem - Reproduce:
go test -run='^$' -bench=BenchmarkPerformanceBaseline -benchmem -count=20 ./pkg/sql/parser/ - Race detector disabled during benchmarks (adds 3–5x overhead)
- Object pooling enabled for all runs (production configuration)
- The CI regression baseline is a deliberately loose ceiling used with a tolerance on slower shared runners; it is not a measurement
Ready to use GoSQLX in your project?