@@ -25,6 +25,7 @@ go get github.com/ajitpratap0/GoSQLX
2525package main
2626
2727import (
28+ " github.com/ajitpratap0/GoSQLX/pkg/sql/ast"
2829 " github.com/ajitpratap0/GoSQLX/pkg/sql/parser"
2930 " github.com/ajitpratap0/GoSQLX/pkg/sql/tokenizer"
3031)
@@ -42,7 +43,7 @@ func main() {
4243 }
4344
4445 // Create a parser
45- p := parser.New ()
46+ p := parser.NewParser ()
4647 defer p.Release () // Clean up resources
4748
4849 // Parse tokens into an AST
7879### Tokenizer Performance
7980
8081```
81- BenchmarkTokenizer/SimpleSQL-16 860258 1233 ns/op
82- BenchmarkTokenizer/ComplexSQL-16 98812 12008 ns/op
83- BenchmarkTokenizerAllocations/SimpleSQL-16 1000000 1228 ns/op 1617 B/op 24 allocs/op
82+ | Benchmark | Operations | Speed (ns/op) | Memory (B/op) | Allocations |
83+ |------------------------------------------|------------|---------------|---------------|-------------|
84+ | BenchmarkTokenizer/SimpleSQL-16 | 860,258 | 1,233 | N/A | N/A |
85+ | BenchmarkTokenizer/ComplexSQL-16 | 98,812 | 12,008 | N/A | N/A |
86+ | BenchmarkTokenizerAllocations/SimpleSQL | 1,000,000 | 1,228 | 1,617 | 24 |
8487```
8588
8689### Parser Performance
8790
8891```
89- BenchmarkParserSimpleSelect-16 6419961 169.9 ns/op 536 B/op 9 allocs/op
90- BenchmarkParserComplexSelect-16 1639564 721.4 ns/op 1433 B/op 36 allocs/op
91- BenchmarkParserInsert-16 5387626 221.3 ns/op 536 B/op 14 allocs/op
92- BenchmarkParserUpdate-16 5944860 199.4 ns/op 584 B/op 12 allocs/op
93- BenchmarkParserDelete-16 8192491 144.4 ns/op 424 B/op 8 allocs/op
92+ | Benchmark | Operations | Speed (ns/op) | Memory (B/op) | Allocations |
93+ |----------------------------------|------------|---------------|---------------|-------------|
94+ | BenchmarkParserSimpleSelect-16 | 6,419,961 | 169.9 | 536 | 9 |
95+ | BenchmarkParserComplexSelect-16 | 1,639,564 | 721.4 | 1,433 | 36 |
96+ | BenchmarkParserInsert-16 | 5,387,626 | 221.3 | 536 | 14 |
97+ | BenchmarkParserUpdate-16 | 5,944,860 | 199.4 | 584 | 12 |
98+ | BenchmarkParserDelete-16 | 8,192,491 | 144.4 | 424 | 8 |
9499```
95100
96101### AST Pool Performance
97102
98103```
99- BenchmarkASTPool/GetReleaseAST-16 169205184 6.650 ns/op 0 B/op 0 allocs/op
100- BenchmarkSelectStatementPool/GetPutSelectStatement-16 11730066 100.2 ns/op 274 B/op 4 allocs/op
101- BenchmarkIdentifierPool/GetPutIdentifier-16 170082399 7.050 ns/op 0 B/op 0 allocs/op
104+ | Benchmark | Operations | Speed (ns/op) | Memory (B/op) | Allocations |
105+ |--------------------------------------------------|-------------|---------------|---------------|-------------|
106+ | BenchmarkASTPool/GetReleaseAST-16 | 169,205,184 | 6.65 | 0 | 0 |
107+ | BenchmarkSelectStatementPool/GetPutSelectStmt-16 | 11,730,066 | 100.2 | 274 | 4 |
108+ | BenchmarkIdentifierPool/GetPutIdentifier-16 | 170,082,399 | 7.05 | 0 | 0 |
102109```
103110
104111## Examples
0 commit comments