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

Test new iai-callgrind #29

Closed
wants to merge 2 commits into from
Closed
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
31 changes: 28 additions & 3 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,8 +25,13 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- 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}
- name: Install iai-callgrind-runner for base 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 base branch
run: |
cargo update
Expand All @@ -36,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
Expand All @@ -44,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
Expand All @@ -53,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
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)'] }

Expand Down
7 changes: 5 additions & 2 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
);
Loading