-
Notifications
You must be signed in to change notification settings - Fork 166
32 lines (28 loc) · 997 Bytes
/
benchmark.yml
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
name: Run benchmarks
on:
pull_request:
branches: [master]
permissions:
contents: read
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
# Base for comparison is master branch.
- name: Checkout code
uses: actions/checkout@v4.2.2
with:
ref: master
- name: Install Go
uses: actions/setup-go@v5.3.0
with:
go-version-file: 'go.mod'
# 30 runs with 100ms benchtime seems to result in acceptable p-values
# When I tried with count=10, it would be unreliable because of the actions
# runner is in a shared environment and CPU and mem would be affected by others. (or so I think)
- run: go test -run=none -bench=. -count=30 -benchtime=100ms -timeout=20m > /tmp/prev
- name: Checkout code
uses: actions/checkout@v4.2.2
- run: go test -run=none -bench=. -count=30 -benchtime=100ms -timeout=20m > /tmp/curr
- run: go install golang.org/x/perf/cmd/benchstat@latest
- run: benchstat /tmp/prev /tmp/curr