Skip to content

Commit bea4a96

Browse files
authored
Update dependencies. Switch from iai to iai-callgrind (#311)
1 parent 8db6d70 commit bea4a96

File tree

14 files changed

+429
-338
lines changed

14 files changed

+429
-338
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
push:
88
branches: [master]
99

10-
# Run a scheduled CI every day to catch regressions from nightly or new version
11-
# releases early.
10+
# Run a scheduled CI every day to catch regressions from nightly or new
11+
# version releases early.
1212
schedule:
1313
- cron: 0 12 * * *
1414

@@ -28,9 +28,7 @@ env:
2828
jobs:
2929
# Sanity-check that benchmarks work
3030
runtime-benchmarks:
31-
# We are using a bit older version for an older `valgrind`, because the newer
32-
# version has some breaking change in cachegrind output, which `iai` can't parse.
33-
runs-on: ubuntu-22.04
31+
runs-on: ubuntu-latest
3432
strategy:
3533
matrix:
3634
benchmark:
@@ -45,6 +43,9 @@ jobs:
4543
- uses: actions/checkout@v4
4644
- uses: actions-rust-lang/setup-rust-toolchain@v1
4745

46+
- uses: taiki-e/install-action@cargo-binstall
47+
- run: cargo binstall iai-callgrind-runner --version $(cargo pkgid iai-callgrind | cut -d@ -f2)
48+
4849
- run: sudo apt-get update && sudo apt-get install -y valgrind
4950
- run: cd ./benchmarks/runtime && ./run.sh ${{ matrix.benchmark }}
5051

@@ -114,8 +115,14 @@ jobs:
114115

115116
- run: cargo clippy --all-features --all-targets ${{ matrix.locked }}
116117

117-
- run: cargo test ${{ matrix.locked }} --all-features --all-targets
118-
- run: cargo test ${{ matrix.locked }} --all-features --doc
118+
- run: |
119+
cargo test ${{ matrix.locked }} --workspace --all-features \
120+
--exclude runtime-benchmarks --all-targets
121+
122+
- run: |
123+
cargo test ${{ matrix.locked }} --workspace --all-features \
124+
--exclude runtime-benchmarks --doc
125+
119126
- run: |
120127
cd bon && cargo test ${{ matrix.locked }} --no-default-features \
121128
--features=experimental-overwritable
@@ -276,7 +283,7 @@ jobs:
276283

277284
- uses: actions/setup-node@v4
278285
with:
279-
node-version: 22
286+
node-version: 24
280287
cache: npm
281288
cache-dependency-path: website/package-lock.json
282289

.github/workflows/deploy-website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- uses: actions/setup-node@v4
3030
with:
31-
node-version: 20
31+
node-version: 24
3232
cache: npm
3333
cache-dependency-path: website/package-lock.json
3434

Cargo.lock

Lines changed: 91 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ resolver = "2"
1515
debug = 0
1616
opt-level = 3
1717

18+
# Required as per iai-callgrind:
19+
# https://iai-callgrind.github.io/iai-callgrind/latest/html/installation/prerequisites.html
20+
[profile.bench]
21+
debug = true
22+
1823
[workspace.lints.clippy]
1924
# We are targeting a pre-let-else MSRV so we can't use it
2025
manual_let_else = "allow"

benchmarks/runtime/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = """
77
Crate for benchmarking of the code generated by proc-macros in the `bon` crate.
88
"""
99

10-
edition = "2021"
10+
edition = "2024"
1111
version = "0.1.0"
1212

1313
[lints]
@@ -35,5 +35,5 @@ bon = { path = "../../bon" }
3535
cfg-if = "1.0"
3636

3737
[dev-dependencies]
38-
criterion = "0.5"
39-
iai = "0.1"
38+
criterion = "0.6"
39+
iai-callgrind = "0.15"

benchmarks/runtime/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ This is a collection of runtime benchmarks for the code generated by `bon` crate
66

77
If you'd like to run the benchmarks yourself, first you need to install the following:
88

9-
- `Valgrind`. Its `cachegrind` component is used by [`iai`](https://github.com/bheisler/iai) benchmark to display the instruction counts and cache/RAM hits.
9+
- `Valgrind`. Its `cachegrind` component is used by [`iai`](https://github.com/iai-callgrind/iai-callgrind) benchmark to display the instruction counts and cache/RAM hits.
1010
- `cargo-asm`. It's used to get the resulting assembly code for the benchmarked functions.
1111

1212
If you are on Ubuntu or Debian, just run the following commands to install the dependencies:
1313

1414
```bash
15-
cargo install cargo-asm
15+
cargo install cargo-asm iai-callgrind-runner@$(cargo pkgid iai-callgrind | cut -d@ -f2)
1616
sudo apt install valgrind
1717
```
1818

benchmarks/runtime/benches/iai.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#![allow(missing_docs)]
2+
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
23

3-
use runtime_benchmarks::{builder_bench, regular_bench};
4+
#[library_benchmark]
5+
fn regular_bench() {
6+
runtime_benchmarks::regular_bench();
7+
}
48

5-
iai::main!(builder_bench, regular_bench);
9+
#[library_benchmark]
10+
fn builder_bench() {
11+
runtime_benchmarks::builder_bench();
12+
}
13+
14+
library_benchmark_group!(
15+
name = bench_builder_group;
16+
benchmarks = regular_bench, builder_bench
17+
);
18+
19+
main!(library_benchmark_groups = bench_builder_group);

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"devDependencies": {
3-
"prettier": "^3.5.3"
3+
"prettier": "^3.6.1"
44
}
55
}

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.87.0"
2+
channel = "1.88.0"
33
components = ["cargo"]

0 commit comments

Comments
 (0)