Skip to content

Commit b68e646

Browse files
Setup benchmarks (#70)
* Setup benchmarks with Criterion.rs * Add `tracing` feature to use with benchmarks to generate tracing information for the Tracy profiler (https://github.com/wolfpld/tracy)
1 parent 2054514 commit b68e646

9 files changed

+949
-18
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
**/*.rs.bk
33

44
.vscode
5+
6+
bench_content/**/

CONTRIBUTING.md

+31
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Thank you for your interest in contributing to this tool! There are different wa
1919
- [End-to-end Tests](#end-to-end-tests)
2020
- [Code formatter](#code-formatter-1)
2121
- [Clippy](#clippy)
22+
- [Benchmarks](#benchmarks)
2223
- [Help](#help)
2324
- [clippy is failing on CI but not locally](#clippy-is-failing-on-ci-but-not-locally)
2425

@@ -152,6 +153,36 @@ To get a full report and what needs to be fixed, run:
152153
cargo clippy --all-targets --all-features -- -D warnings
153154
```
154155

156+
## Benchmarks
157+
158+
Benchmarking is done using [Criterion.rs](https://github.com/bheisler/criterion.rs).
159+
160+
The benchmarks will depend on public Lua sources that are not committed to the repository. To fetch the content, simply run:
161+
162+
```sh
163+
./bench_content/download_content.sh
164+
```
165+
166+
To run benchmarks, run:
167+
168+
```sh
169+
cargo bench
170+
```
171+
172+
Benchmark reports are generated automatically under `target/criterion/`.
173+
174+
### Benchmark Tracing
175+
176+
Some benchmarks may emit tracing information that can be captured with the [Tracy profiler](https://github.com/wolfpld/tracy). To setup a benchmark to emit information to Tracy, look for other benchmarks that do it (search for `TracyLayer::new()`).
177+
178+
Using Tracy is simple: download the exectuable the release from GitHub, run it and connect.
179+
180+
When running benchmarks, enable the the `tracing` feature:
181+
182+
```sh
183+
cargo bench --features tracing
184+
```
185+
155186
## Help
156187

157188
### clippy is failing on CI but not locally

0 commit comments

Comments
 (0)