Skip to content

Commit 3bad04e

Browse files
authored
Test benchmarks and Improve benchmark README.md (#1627)
1 parent fe36020 commit 3bad04e

File tree

3 files changed

+522
-1
lines changed

3 files changed

+522
-1
lines changed

.github/workflows/rust.yml

+8
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:

sqlparser_bench/README.md

+23-1
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)

0 commit comments

Comments
 (0)