Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: simplify rust benchmarks definition #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions crates/bencher_compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ Bencher compatibility layer for CodSpeed
## Installation

```sh
cargo add --dev codspeed-bencher-compat
cargo add --dev codspeed-bencher-compat --rename bencher
```

> [!NOTE]
> This will install the `codspeed-bencher-compat` crate and rename it to `bencher` in your `Cargo.toml`.
> This way, you can keep your existing imports and the compatibility layer will take care of the rest.
>
> Using the compatibility layer won't change the behavior of your benchmark suite and Bencher will still run it as usual.

## Usage

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

### Plugging CodSpeed

To allow CodSpeed to interact with this suite as well, you simply need to replace
the imports from the `bencher` crate to the `codspeed-bencher-compat` crate:

```diff
- use bencher::{benchmark_group, benchmark_main, Bencher};
+ use codspeed_bencher_compat::{benchmark_group, benchmark_main, Bencher};
```

And that's it! You can now run your benchmark suite with CodSpeed:

```
Expand Down
18 changes: 7 additions & 11 deletions crates/criterion_compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ Criterion.rs compatibility layer for CodSpeed
## Installation

```sh
cargo add --dev codspeed-criterion-compat
cargo add --dev codspeed-criterion-compat --rename criterion
```

> [!NOTE]
> This will install the `codspeed-criterion-compat` crate and rename it to `criterion` in your `Cargo.toml`.
> This way, you can keep your existing imports and the compatibility layer will take care of the rest.
>
> Using the compatibility layer won't change the behavior of your benchmark suite and Criterion.rs will still run it as usual.

## Usage

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

### Plugging CodSpeed

To allow CodSpeed to interact with this suite as well, you simply need to replace
the imports from the `criterion` crate to the `codspeed-criterion-compat` crate:

```diff
- use criterion::{black_box, criterion_group, criterion_main, Criterion};
+ use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion};
```

And that's it! You can now run your benchmark suite with `cargo-codspeed`:

```
Expand Down
Loading