diff --git a/Cargo.toml b/Cargo.toml index a402cbd..d756b08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,7 +106,7 @@ tempfile = { version = "3.13.0" } monero-rpc = { git = "https://github.com/Cuprate/serai.git", rev = "d5205ce" } monero-simple-request-rpc = { git = "https://github.com/Cuprate/serai.git", rev = "d5205ce" } pretty_assertions = { version = "1.4.1" } -proptest = { version = "1" } +proptest = { version = "1.5.0" } proptest-derive = { version = "0.4.0" } tokio-test = { version = "0.4.4" } diff --git a/benches/criterion/cuprate-json-rpc/benches/main.rs b/benches/criterion/cuprate-json-rpc/benches/main.rs index 578dd8e..8bdc5f7 100644 --- a/benches/criterion/cuprate-json-rpc/benches/main.rs +++ b/benches/criterion/cuprate-json-rpc/benches/main.rs @@ -1,8 +1,10 @@ //! Benchmarks for `cuprate-json-rpc`. +//! +//! TODO: this crate is not finished. #![allow(unused_crate_dependencies)] mod response; criterion::criterion_main! { - response::benches, + response::serde, } diff --git a/benches/criterion/cuprate-json-rpc/benches/response.rs b/benches/criterion/cuprate-json-rpc/benches/response.rs index c1a1341..3ac9953 100644 --- a/benches/criterion/cuprate-json-rpc/benches/response.rs +++ b/benches/criterion/cuprate-json-rpc/benches/response.rs @@ -7,8 +7,11 @@ use serde_json::{from_str, to_string_pretty}; use cuprate_json_rpc::{Id, Response}; +// `serde` benchmarks on `Response`. criterion_group! { - benches, + name = serde; + config = Criterion::default(); + targets = response_from_str_u8, response_from_str_u64, response_from_str_string_5_len, @@ -22,7 +25,7 @@ criterion_group! { response_to_string_pretty_string_100_len, response_to_string_pretty_string_500_len, } -criterion_main!(benches); +criterion_main!(serde); /// Generate `from_str` deserialization benchmark functions for [`Response`]. macro_rules! impl_from_str_benchmark { diff --git a/benches/criterion/cuprate-json-rpc/src/lib.rs b/benches/criterion/cuprate-json-rpc/src/lib.rs index 8a892fc..cf9ea54 100644 --- a/benches/criterion/cuprate-json-rpc/src/lib.rs +++ b/benches/criterion/cuprate-json-rpc/src/lib.rs @@ -1,2 +1,2 @@ -//! TODO +//! TODO: this crate is not finished. #![allow(unused_crate_dependencies, reason = "used in benchmarks")] diff --git a/books/architecture/src/benchmarking/criterion/creating.md b/books/architecture/src/benchmarking/criterion/creating.md index faf78bb..0100904 100644 --- a/books/architecture/src/benchmarking/criterion/creating.md +++ b/books/architecture/src/benchmarking/criterion/creating.md @@ -6,5 +6,16 @@ although, it requires knowledge of how to use Criterion first: 2. Copy [`benches/criterion/example`](https://github.com/Cuprate/cuprate/tree/main/benches/criterion/example) as base 3. Get started +## Naming +New benchmark crates using Criterion should: +- Be in [`benches/criterion/`](https://github.com/Cuprate/cuprate/tree/main/benches/criterion/) +- Be in the `cuprate-criterion-$CRATE_NAME` format + For a real example, see: -[`cuprate-criterion-json-rpc`](https://github.com/Cuprate/cuprate/tree/main/benches/criterion/cuprate-json-rpc). \ No newline at end of file +[`cuprate-criterion-json-rpc`](https://github.com/Cuprate/cuprate/tree/main/benches/criterion/cuprate-json-rpc). + +## Workspace +Finally, make sure to add the benchmark crate to the workspace +[`Cargo.toml`](https://github.com/Cuprate/cuprate/blob/main/Cargo.toml) file. + +Your benchmark is now ready to be ran. \ No newline at end of file diff --git a/books/architecture/src/benchmarking/cuprate/creating.md b/books/architecture/src/benchmarking/cuprate/creating.md index 805c576..76eab78 100644 --- a/books/architecture/src/benchmarking/cuprate/creating.md +++ b/books/architecture/src/benchmarking/cuprate/creating.md @@ -4,8 +4,7 @@ New benchmarks are plugged into `cuprate-benchmark` by: 1. Registering the benchmark in the `cuprate_benchmark` binary See [`benches/benchmark/example`](https://github.com/Cuprate/cuprate/tree/main/benches/benchmark/example) -for an example. For a real example, see: -[`cuprate-benchmark-database`](https://github.com/Cuprate/cuprate/tree/main/benches/benchmark/cuprate-database). +for an example. ## Creating the benchmark crate Before plugging into `cuprate-benchmark`, your actual benchmark crate must be created: @@ -15,6 +14,13 @@ Before plugging into `cuprate-benchmark`, your actual benchmark crate must be cr 1. Create a benchmark 1. Implement `cuprate_benchmark_lib::Benchmark` +New benchmark crates using `cuprate-database` should: +- Be in [`benches/benchmark/`](https://github.com/Cuprate/cuprate/tree/main/benches/benchmark/) +- Be in the `cuprate-benchmark-$CRATE_NAME` format + +For a real example, see: +[`cuprate-benchmark-database`](https://github.com/Cuprate/cuprate/tree/main/benches/benchmark/cuprate-database). + ## `cuprate_benchmark_lib::Benchmark` This is the trait that standardizes all benchmarks ran under `cuprate-benchmark`. @@ -42,4 +48,10 @@ cfg_if! { run::run_benchmark::(&mut timings); } } -``` \ No newline at end of file +``` + +## Workspace +Finally, make sure to add the benchmark crate to the workspace +[`Cargo.toml`](https://github.com/Cuprate/cuprate/blob/main/Cargo.toml) file. + +Your benchmark is now ready to be ran. \ No newline at end of file