Bench #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bench | |
on: | |
workflow_run: | |
workflows: [CI] | |
types: [completed] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
TOOLCHAIN: nightly | |
jobs: | |
bench: | |
name: Benchmark | |
runs-on: self-hosted | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: $TOOLCHAIN | |
- name: Use sccache | |
uses: mozilla-actions/[email protected] | |
- name: Enable sscache | |
run: | | |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" | |
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get install -y --no-install-recommends \ | |
git gyp mercurial ninja-build lld python-is-python3 zlib1g-dev \ | |
linux-tools-common linux-tools-generic linux-tools-$(uname -r) | |
echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld" >> "$GITHUB_ENV" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.workflow_run.head_branch }} | |
- name: Prepare machine | |
run: | | |
# Disable turboboost | |
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo | |
# Disable hyperthreading | |
echo off > /sys/devices/system/cpu/smt/control | |
# Use performance governor | |
cpupower frequency-set -g performance | |
- name: Benchmark | |
run: nice -n -10 taskset -c 0 cargo +$TOOLCHAIN bench --features ci,bench | tee output.txt | |
- name: Restore machine | |
run: | | |
# Enable turboboost | |
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo | |
# Enable hyperthreading | |
echo on > /sys/devices/system/cpu/smt/control | |
# Use powersave governor | |
cpupower frequency-set -g powersave | |
- name: Download previous benchmark results | |
uses: actions/cache@v4 | |
with: | |
path: ./cache | |
key: ${{ runner.os }}-benchmark | |
# - name: Store current benchmark results | |
# uses: benchmark-action/github-action-benchmark@v1 | |
# with: | |
# tool: 'cargo' | |
# output-file-path: output.txt | |
# external-data-json-path: ./cache/benchmark-data.json | |
# fail-on-alert: true | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# comment-on-alert: true | |
# summary-always: true | |