-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b6c26f
commit 1bb13cc
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# `rbx_binary` Benchmark Suite | ||
|
||
This directory contains a suite of benchmarks used to measure the performance of the `rbx_binary` serializer and deserializer. | ||
|
||
### Adding a new benchmark | ||
|
||
To add a new benchmark, first add the file you'd like to measure performance against to the `files` directory. Then, add a new benchmark function to `suite/main.rs`, like this: | ||
```rust | ||
pub fn my_benchmark(c: &mut Criterion) { | ||
bench( | ||
&mut c.benchmark_group("My Benchmark") | ||
include_bytes!("../files/bench-file.rbxl"), | ||
) | ||
} | ||
``` | ||
and also make sure to add your benchmark function to the `criterion_group!` macro invocation. | ||
|
||
Benchmark groups provide a number of configuration options which are useful under different circumstances. See the [Criterion.rs benchmark configuration documentation](https://bheisler.github.io/criterion.rs/book/user_guide/advanced_configuration.html) for details. | ||
|
||
### Running the benchmarks | ||
|
||
To run all benchmarks, run the following command somewhere in the `rbx_binary` crate directory: | ||
```bash | ||
cargo bench | ||
``` | ||
|
||
To run a specific benchmark, run the following command somewhere in the `rbx_binary` crate directory, subsituting `My Benchmark` with the name of the benchmark group: | ||
```bash | ||
cargo bench "My Benchmark" | ||
``` | ||
|
||
To measure only serialization or deserialization, add `/Serialize` or `/Deserialize` to the end of the benchmark name, like this: | ||
```bash | ||
cargo bench "My Benchmark/Serialize" | ||
``` | ||
|
||
Once the benchmark is complete, an HTML report will be generated at `rbx-dom/target/criterion/reports/index.html` that contains detailed statistics collected during the run. This file can be opened in a web browser. | ||
|
||
For more information, see the [Criterion.rs documentation](https://bheisler.github.io/criterion.rs/book/). |