Skip to content

Commit 8f12792

Browse files
committed
docs: simplify rust benchmarks definition
1 parent ac3dae8 commit 8f12792

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

crates/bencher_compat/README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ 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+
1925
## Usage
2026

2127
Let's start with the example from the [Bencher documentation](https://docs.rs/bencher/latest/bencher/),
@@ -51,16 +57,6 @@ name = "example"
5157
harness = false
5258
```
5359

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-
6460
And that's it! You can now run your benchmark suite with CodSpeed:
6561

6662
```

crates/criterion_compat/README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ 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+
1925
## Usage
2026

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

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-
6157
And that's it! You can now run your benchmark suite with `cargo-codspeed`:
6258

6359
```

0 commit comments

Comments
 (0)