Skip to content

Use iai-callgrind instead of iai #37

Use iai-callgrind instead of iai

Use iai-callgrind instead of iai #37

Workflow file for this run

name: Benchmark
on:
pull_request:
types: [labeled]
env:
IAI_CALLGRIND_VERSION: 0.7.3
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
bench:
if: contains(github.event.pull_request.labels.*.name, 'run benchmarks')
permissions:
pull-requests: write
env:
WORKSPACE: ${{ github.workspace }}
URL: ${{ github.event.pull_request.comments_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.ref }}
- 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: Bench base branch
run: |
cargo update
cargo bench -q --bench bench > "${WORKSPACE}"/____old_results.txt
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
clean: false
- name: Bench head branch
run: |
cargo update
cargo bench -q --bench bench > "${WORKSPACE}"/____results.txt
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.ref }}
clean: false
- name: Bench base branch no finalization
run: |
cargo clean
cargo update
cargo bench --no-default-features -F auto-collect -q --bench bench > "${WORKSPACE}"/____old_results_no_finalization.txt
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
clean: false
- name: Bench head branch no finalization
run: |
cargo update
cargo bench --no-default-features -F auto-collect -q --bench bench > "${WORKSPACE}"/____results_no_finalization.txt
- name: Write comment
run: |
{
echo '<strong>Benchmark results:</strong>'
echo ''
cat "${WORKSPACE}"/____results.txt
echo ''
echo '<details><summary><strong>Old results:</strong></summary><p>'
echo ''
cat "${WORKSPACE}"/____old_results.txt
echo '</p></details>'
echo ''
echo '---'
echo ''
echo '<details><summary><strong>Results without finalization:</strong></summary><p>'
echo ''
cat "${WORKSPACE}"/____results_no_finalization.txt
echo ''
echo '<details><summary><strong>Old results without finalization:</strong></summary><p>'
echo ''
cat "${WORKSPACE}"/____old_results_no_finalization.txt
echo '</p></details></p></details>'
} > "${WORKSPACE}"/__result.txt
- uses: thollander/[email protected]
with:
filePath: '__result.txt'
mode: recreate
- name: Remove label
uses: actions-ecosystem/[email protected]
with:
labels: "run benchmarks"