Skip to content
Merged
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
23 changes: 15 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
push:
branches: [master]

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

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

- uses: taiki-e/install-action@cargo-binstall
- run: cargo binstall iai-callgrind-runner --version $(cargo pkgid iai-callgrind | cut -d@ -f2)

- run: sudo apt-get update && sudo apt-get install -y valgrind
- run: cd ./benchmarks/runtime && ./run.sh ${{ matrix.benchmark }}

Expand Down Expand Up @@ -114,8 +115,14 @@ jobs:

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

- run: cargo test ${{ matrix.locked }} --all-features --all-targets
- run: cargo test ${{ matrix.locked }} --all-features --doc
- run: |
cargo test ${{ matrix.locked }} --workspace --all-features \
--exclude runtime-benchmarks --all-targets

- run: |
cargo test ${{ matrix.locked }} --workspace --all-features \
--exclude runtime-benchmarks --doc

- run: |
cd bon && cargo test ${{ matrix.locked }} --no-default-features \
--features=experimental-overwritable
Expand Down Expand Up @@ -276,7 +283,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: npm
cache-dependency-path: website/package-lock.json

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
cache: npm
cache-dependency-path: website/package-lock.json

Expand Down
112 changes: 91 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ resolver = "2"
debug = 0
opt-level = 3

# Required as per iai-callgrind:
# https://iai-callgrind.github.io/iai-callgrind/latest/html/installation/prerequisites.html
[profile.bench]
debug = true

[workspace.lints.clippy]
# We are targeting a pre-let-else MSRV so we can't use it
manual_let_else = "allow"
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = """
Crate for benchmarking of the code generated by proc-macros in the `bon` crate.
"""

edition = "2021"
edition = "2024"
version = "0.1.0"

[lints]
Expand Down Expand Up @@ -35,5 +35,5 @@ bon = { path = "../../bon" }
cfg-if = "1.0"

[dev-dependencies]
criterion = "0.5"
iai = "0.1"
criterion = "0.6"
iai-callgrind = "0.15"
4 changes: 2 additions & 2 deletions benchmarks/runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ This is a collection of runtime benchmarks for the code generated by `bon` crate

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

- `Valgrind`. Its `cachegrind` component is used by [`iai`](https://github.com/bheisler/iai) benchmark to display the instruction counts and cache/RAM hits.
- `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.
- `cargo-asm`. It's used to get the resulting assembly code for the benchmarked functions.

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

```bash
cargo install cargo-asm
cargo install cargo-asm iai-callgrind-runner@$(cargo pkgid iai-callgrind | cut -d@ -f2)
sudo apt install valgrind
```

Expand Down
18 changes: 16 additions & 2 deletions benchmarks/runtime/benches/iai.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#![allow(missing_docs)]
use iai_callgrind::{library_benchmark, library_benchmark_group, main};

use runtime_benchmarks::{builder_bench, regular_bench};
#[library_benchmark]
fn regular_bench() {
runtime_benchmarks::regular_bench();
}

iai::main!(builder_bench, regular_bench);
#[library_benchmark]
fn builder_bench() {
runtime_benchmarks::builder_bench();
}

library_benchmark_group!(
name = bench_builder_group;
benchmarks = regular_bench, builder_bench
);

main!(library_benchmark_groups = bench_builder_group);
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"devDependencies": {
"prettier": "^3.5.3"
"prettier": "^3.6.1"
}
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.87.0"
channel = "1.88.0"
components = ["cargo"]
Loading