Repository navigation
87 lines (75 loc) · 2.87 KB
/
Copy pathperformance.yml
File metadata and controls
87 lines (75 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Performance
# Instruction-count regression measurement.
#
# Deliberately NOT wall-clock: a shared GitHub runner's elapsed time moves more
# between runs than most real regressions, so a wall-clock threshold is either
# too loose to catch anything or too tight to trust. Callgrind counts executed
# instructions under emulation, which is independent of machine load and
# reproducible run-to-run, so a change in it is a change in work done.
on:
# Prose and the docs site execute no measured code.
pull_request:
paths-ignore:
- "docs/**"
- "**/*.md"
push:
branches: [main]
paths-ignore:
- "docs/**"
- "**/*.md"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: performance-${{ github.ref }}
cancel-in-progress: true
jobs:
regression:
name: Instruction-count regression
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The comparison needs the base commit to measure against.
fetch-depth: 0
- uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067
with:
toolchain: 1.99.1
- name: Install valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Read the declared iai-callgrind version
id: iai
run: |
version="$(grep -m1 '^iai-callgrind' tools/benchmark/Cargo.toml | sed 's/.*"\(.*\)".*/\1/')"
echo "version=${version}" >> "$GITHUB_OUTPUT"
# The runner binary must match the library version exactly or it refuses
# to run, so the version is read from the manifest rather than pinned
# twice and allowed to drift.
- name: Install iai-callgrind-runner
run: cargo install iai-callgrind-runner --version "${{ steps.iai.outputs.version }}"
- name: Measure the base commit
if: github.event_name == 'pull_request'
run: |
git checkout --quiet "${{ github.event.pull_request.base.sha }}"
# A base commit predating the benchmark crate has nothing to measure;
# that is not a failure, it is the first run.
if [ -d tools/benchmark ]; then
bash scripts/bench-regression.sh || true
else
echo "base commit has no benchmark crate; nothing to compare against"
fi
git checkout --quiet -
- name: Measure this commit
run: bash scripts/bench-regression.sh
- name: Keep the measurements
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: callgrind-measurements
# Honour a CARGO_TARGET_DIR override if one is ever set.
path: ${{ env.CARGO_TARGET_DIR || 'target' }}/iai/
if-no-files-found: ignore
retention-days: 14