-
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.
Merge branch 'master' into dynamic-reflection-pog
- Loading branch information
Showing
86 changed files
with
4,960 additions
and
2,442 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
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
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 |
---|---|---|
|
@@ -9,3 +9,5 @@ Change: | |
Scriptability: Custom | ||
WorldPivotData: | ||
Scriptability: Custom | ||
DefaultValue: | ||
OptionalCFrame: ~ |
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,4 @@ | ||
Change: | ||
Object: | ||
className: | ||
AliasFor: ClassName |
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
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
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/). |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
mod util; | ||
|
||
use crate::util::bench; | ||
use criterion::{criterion_group, criterion_main, Criterion, SamplingMode}; | ||
|
||
pub fn folders_100(c: &mut Criterion) { | ||
bench( | ||
&mut c.benchmark_group("100 Folders"), | ||
include_bytes!("../files/folders-100.rbxm"), | ||
) | ||
} | ||
|
||
pub fn deep_folders_100(c: &mut Criterion) { | ||
bench( | ||
&mut c.benchmark_group("100 Deep Folders"), | ||
include_bytes!("../files/deep-folders-100.rbxm"), | ||
) | ||
} | ||
|
||
pub fn modulescripts_100_lines_100(c: &mut Criterion) { | ||
bench( | ||
&mut c.benchmark_group("100 100-line ModuleScripts"), | ||
include_bytes!("../files/modulescripts-100-lines-100.rbxm"), | ||
) | ||
} | ||
|
||
pub fn parts_1000(c: &mut Criterion) { | ||
bench( | ||
c.benchmark_group("1,000 Parts") | ||
.sampling_mode(SamplingMode::Flat), | ||
include_bytes!("../files/parts-1000.rbxm"), | ||
) | ||
} | ||
|
||
pub fn miners_haven(c: &mut Criterion) { | ||
bench( | ||
c.benchmark_group("Miner's Haven") | ||
.sampling_mode(SamplingMode::Flat), | ||
include_bytes!("../files/miners-haven.rbxl"), | ||
) | ||
} | ||
|
||
criterion_group!( | ||
bench_suite, | ||
folders_100, | ||
deep_folders_100, | ||
modulescripts_100_lines_100, | ||
parts_1000, | ||
miners_haven, | ||
); | ||
|
||
criterion_main!(bench_suite); |
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,42 @@ | ||
use criterion::{measurement::Measurement, BatchSize, BenchmarkGroup, Throughput}; | ||
|
||
pub(crate) fn bench<T: Measurement>(group: &mut BenchmarkGroup<T>, bench_file: &'static [u8]) { | ||
serialize_bench(group, bench_file); | ||
deserialize_bench(group, bench_file); | ||
} | ||
|
||
fn serialize_bench<T: Measurement>(group: &mut BenchmarkGroup<T>, buffer: &[u8]) { | ||
let tree = rbx_binary::from_reader(buffer).unwrap(); | ||
let root_ref = tree.root_ref(); | ||
let mut buffer = Vec::new(); | ||
|
||
rbx_binary::to_writer(&mut buffer, &tree, &[root_ref]).unwrap(); | ||
let buffer_len = buffer.len(); | ||
let batch_size = if buffer_len > 1024 { | ||
BatchSize::LargeInput | ||
} else { | ||
BatchSize::SmallInput | ||
}; | ||
|
||
group | ||
.throughput(Throughput::Bytes(buffer_len as u64)) | ||
.bench_function("Serialize", |b| { | ||
b.iter_batched( | ||
|| Vec::with_capacity(buffer_len), | ||
|mut buffer: Vec<u8>| { | ||
rbx_binary::to_writer(&mut buffer, &tree, &[root_ref]).unwrap(); | ||
}, | ||
batch_size, | ||
) | ||
}); | ||
} | ||
|
||
fn deserialize_bench<T: Measurement>(group: &mut BenchmarkGroup<T>, buffer: &[u8]) { | ||
group | ||
.throughput(Throughput::Bytes(buffer.len() as u64)) | ||
.bench_function("Deserialize", |bencher| { | ||
bencher.iter(|| { | ||
rbx_binary::from_reader(buffer).unwrap(); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.