From 38354ee0eda5d6faa28206f5638b54b26184605f Mon Sep 17 00:00:00 2001 From: fren_gor Date: Wed, 31 Jul 2024 07:06:46 +0200 Subject: [PATCH 1/2] Update iai-callgrind to 0.12.1 --- .github/workflows/bench.yml | 8 ++++++-- Cargo.toml | 6 +++++- benches/bench.rs | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 527b562..6c2d370 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -5,7 +5,6 @@ on: types: [labeled] env: - IAI_CALLGRIND_VERSION: 0.7.3 CARGO_TERM_COLOR: always IAI_CALLGRIND_COLOR: never CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse @@ -27,7 +26,12 @@ jobs: - uses: taiki-e/install-action@valgrind - uses: taiki-e/install-action@cargo-binstall - name: Install iai-callgrind-runner - run: cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version ${IAI_CALLGRIND_VERSION} + run: | + version=$(cargo metadata --format-version=1 |\ + jq '.packages[] | select(.name == "iai-callgrind").version' |\ + tr -d '"' + ) + cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version "${version}" - name: Bench base branch run: | cargo update diff --git a/Cargo.toml b/Cargo.toml index af35b42..c576385 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ slotmap = { version = "1.0", optional = true } thiserror = { version = "1.0", package = "thiserror-core", default-features = false } [dev-dependencies] -iai-callgrind = "=0.7.3" # Also update IAI_CALLGRIND_VERSION in .github/workflows/bench.yml +iai-callgrind = "=0.12.1" rand = "0.8.3" trybuild = "1.0.85" test-case = "3.3.1" @@ -64,6 +64,10 @@ name = "bench" harness = false required-features = ["std", "derive"] +[profile.bench] +debug = true # Required by iai-callgrind +strip = false # Required by iai-callgrind + [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_auto_cfg)'] } diff --git a/benches/bench.rs b/benches/bench.rs index 1cbd4ee..51bdbec 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -8,7 +8,7 @@ mod benches { } use std::hint::black_box; -use iai_callgrind::{library_benchmark, library_benchmark_group, main}; +use iai_callgrind::{library_benchmark, library_benchmark_group, LibraryBenchmarkConfig, main}; use crate::benches::binary_trees::count_binary_trees; use crate::benches::binary_trees_with_parent_pointers::count_binary_trees_with_parent; use crate::benches::large_linked_list::large_linked_list; @@ -53,4 +53,7 @@ library_benchmark_group!( benchmarks = large_linked_list_bench ); -main!(library_benchmark_groups = stress_tests_group, binary_trees_group, linked_lists_group); +main!( + config = LibraryBenchmarkConfig::default().raw_callgrind_args(["--branch-sim=yes"]); + library_benchmark_groups = stress_tests_group, binary_trees_group, linked_lists_group +); From cba8d839e15e383c08e3f4d5906a7b40f2e26444 Mon Sep 17 00:00:00 2001 From: fren_gor Date: Wed, 31 Jul 2024 07:16:39 +0200 Subject: [PATCH 2/2] Don't fail for different iai-callgrind versions --- .github/workflows/bench.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 6c2d370..7a65571 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -25,7 +25,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@valgrind - uses: taiki-e/install-action@cargo-binstall - - name: Install iai-callgrind-runner + - name: Install iai-callgrind-runner for base branch run: | version=$(cargo metadata --format-version=1 |\ jq '.packages[] | select(.name == "iai-callgrind").version' |\ @@ -40,6 +40,13 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} clean: false + - name: Install iai-callgrind-runner for head branch + run: | + version=$(cargo metadata --format-version=1 |\ + jq '.packages[] | select(.name == "iai-callgrind").version' |\ + tr -d '"' + ) + cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version "${version}" - name: Bench head branch run: | cargo update @@ -48,6 +55,13 @@ jobs: with: ref: ${{ github.event.pull_request.base.ref }} clean: false + - name: Install iai-callgrind-runner for base branch no finalization + run: | + version=$(cargo metadata --format-version=1 |\ + jq '.packages[] | select(.name == "iai-callgrind").version' |\ + tr -d '"' + ) + cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version "${version}" - name: Bench base branch no finalization run: | cargo clean @@ -57,6 +71,13 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} clean: false + - name: Install iai-callgrind-runner for head branch no finalization + run: | + version=$(cargo metadata --format-version=1 |\ + jq '.packages[] | select(.name == "iai-callgrind").version' |\ + tr -d '"' + ) + cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version "${version}" - name: Bench head branch no finalization run: | cargo update