Skip to content

Commit 6572517

Browse files
committed
Chore: improve tooling around benchmarks
1 parent 1dc501b commit 6572517

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ install:
44
pip install -e .
55

66
bench: install-dev-rs-release
7-
python benchmarks/bench.py
7+
python -m benchmarks.bench
8+
9+
bench-optimize: install-dev-rs-release
10+
python -m benchmarks.optimize
811

912
install-dev-rs-release:
1013
cd sqlglotrs/ && python -m maturin develop -r

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ make check # Full test suite & linter checks
533533
| long | 0.00889 (1.0) | 0.00572 (0.643) | 0.36982 (41.56) | 0.00614 (0.690) | 0.02530 (2.844) | 0.02931 (3.294) | 0.00059 (0.066) |
534534
| crazy | 0.02918 (1.0) | 0.01991 (0.682) | 1.88695 (64.66) | 0.02003 (0.686) | 7.46894 (255.9) | 0.64994 (22.27) | 0.00327 (0.112) |
535535

536+
```
537+
make bench # Run parsing benchmark
538+
make bench-optimize # Run optimization benchmark
539+
```
536540

537541
## Optional Dependencies
538542

benchmarks/bench.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import collections.abc
22

3-
from helpers import ascii_table
3+
from benchmarks.helpers import ascii_table
44

55
# moz_sql_parser 3.10 compatibility
66
collections.Iterable = collections.abc.Iterable

benchmarks/optimize.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import sys
12
import typing as t
23
from argparse import ArgumentParser
34

4-
from helpers import ascii_table
5+
from benchmarks.helpers import ascii_table
56
from sqlglot.optimizer import optimize
67
from sqlglot import parse_one
78
from tests.helpers import load_sql_fixture_pairs, TPCH_SCHEMA, TPCDS_SCHEMA
89
from timeit import Timer
9-
import sys
1010

1111
# Deeply nested conditions currently require a lot of recursion
1212
sys.setrecursionlimit(10000)

0 commit comments

Comments
 (0)