Skip to content

Commit 7f1ff61

Browse files
committed
Merge branch 'main' into mysql-users
2 parents ed3e591 + 94ea206 commit 7f1ff61

File tree

20 files changed

+1750
-573
lines changed

20 files changed

+1750
-573
lines changed

.github/workflows/rust.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ jobs:
3737
uses: ./.github/actions/setup-builder
3838
- run: cargo clippy --all-targets --all-features -- -D warnings
3939

40+
benchmark-lint:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Setup Rust Toolchain
45+
uses: ./.github/actions/setup-builder
46+
- run: cd sqlparser_bench && cargo clippy --all-targets --all-features -- -D warnings
47+
4048
compile:
4149
runs-on: ubuntu-latest
4250
steps:

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,14 @@ You can run them with:
240240
```
241241
git checkout main
242242
cd sqlparser_bench
243-
cargo bench
243+
cargo bench -- --save-baseline main
244244
git checkout <your branch>
245-
cargo bench
245+
cargo bench -- --baseline main
246246
```
247247

248+
By adding the `--save-baseline main` and `--baseline main` you can track the
249+
progress of your improvements as you continue working on the feature branch.
250+
248251
## Licensing
249252

250253
All code in this repository is licensed under the [Apache Software License 2.0](LICENSE.txt).

sqlparser_bench/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,26 @@
1717
under the License.
1818
-->
1919

20-
Benchmarks for sqlparser. See [the main README](../README.md) for more information.
20+
Benchmarks for sqlparser. See [the main README](../README.md) for more information.
21+
22+
Note: this is in a separate, non workspace crate to avoid adding a dependency
23+
on `criterion` to the main crate (which complicates testing without std).
24+
25+
# Running Benchmarks
26+
27+
```shell
28+
cargo bench --bench sqlparser_bench
29+
```
30+
31+
# Profiling
32+
33+
Note you can generate a [flamegraph] using the following command:
34+
35+
```shell
36+
cargo flamegraph --bench sqlparser_bench
37+
```
38+
39+
[flamegraph]: https://crates.io/crates/flamegraph
40+
41+
Here is an example flamegraph:
42+
![flamegraph](img/flamegraph.svg)

sqlparser_bench/benches/sqlparser_bench.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ fn basic_queries(c: &mut Criterion) {
7878

7979
group.bench_function("format_large_statement", |b| {
8080
b.iter(|| {
81-
let formatted_query = large_statement.to_string();
82-
assert_eq!(formatted_query, large_statement);
81+
let _formatted_query = large_statement.to_string();
8382
});
8483
});
8584
}

0 commit comments

Comments
 (0)