Skip to content

Commit 280d7a0

Browse files
committed
docs: simplify rust benchmarks definition
1 parent 2c67f80 commit 280d7a0

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

crates/bencher_compat/README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ Bencher compatibility layer for CodSpeed
1313
## Installation
1414

1515
```sh
16-
cargo add --dev codspeed-bencher-compat
16+
cargo add --dev codspeed-bencher-compat --rename bencher
1717
```
1818

19+
> [!NOTE]
20+
> This will install the `codspeed-bencher-compat` crate and rename it to `bencher` in your `Cargo.toml`.
21+
> This way, you can keep your existing imports and the compatibility layer will take care of the rest.
22+
>
23+
> Using the compatibility layer won't change the behavior of your benchmark suite and Bencher will still run it as usual.
24+
>
25+
> If you prefer, you can also install `codspeed-bencher-compat` as is and change your imports to use this new crate name.
26+
1927
## Usage
2028

2129
Let's start with the example from the [Bencher documentation](https://docs.rs/bencher/latest/bencher/),
@@ -51,16 +59,6 @@ name = "example"
5159
harness = false
5260
```
5361

54-
### Plugging CodSpeed
55-
56-
To allow CodSpeed to interact with this suite as well, you simply need to replace
57-
the imports from the `bencher` crate to the `codspeed-bencher-compat` crate:
58-
59-
```diff
60-
- use bencher::{benchmark_group, benchmark_main, Bencher};
61-
+ use codspeed_bencher_compat::{benchmark_group, benchmark_main, Bencher};
62-
```
63-
6462
And that's it! You can now run your benchmark suite with CodSpeed:
6563

6664
```

crates/criterion_compat/README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ Criterion.rs compatibility layer for CodSpeed
1313
## Installation
1414

1515
```sh
16-
cargo add --dev codspeed-criterion-compat
16+
cargo add --dev codspeed-criterion-compat --rename criterion
1717
```
1818

19+
> [!NOTE]
20+
> This will install the `codspeed-criterion-compat` crate and rename it to `criterion` in your `Cargo.toml`.
21+
> This way, you can keep your existing imports and the compatibility layer will take care of the rest.
22+
>
23+
> Using the compatibility layer won't change the behavior of your benchmark suite and Criterion.rs will still run it as usual.
24+
>
25+
> If you prefer, you can also install `codspeed-criterion-compat` as is and change your imports to use this new crate name.
26+
1927
## Usage
2028

2129
Let's start with the example from the [Criterion.rs documentation](https://bheisler.github.io/criterion.rs/book/getting_started.html),
@@ -48,16 +56,6 @@ name = "my_benchmark"
4856
harness = false
4957
```
5058

51-
### Plugging CodSpeed
52-
53-
To allow CodSpeed to interact with this suite as well, you simply need to replace
54-
the imports from the `criterion` crate to the `codspeed-criterion-compat` crate:
55-
56-
```diff
57-
- use criterion::{black_box, criterion_group, criterion_main, Criterion};
58-
+ use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion};
59-
```
60-
6159
And that's it! You can now run your benchmark suite with `cargo-codspeed`:
6260

6361
```

0 commit comments

Comments
 (0)