Skip to content

Commit 3cde584

Browse files
committed
add benchmark pipeline
1 parent 7524b4f commit 3cde584

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/benchmark.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Benchmark Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
benchmark:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
22+
- name: Install dependencies
23+
run: |
24+
go mod download
25+
26+
- name: Run benchmark
27+
working-directory: test/e2e
28+
run: |
29+
pwd
30+
ls -la
31+
go version
32+
go env
33+
go clean -testcache
34+
go test -v -run=^$ -bench=. -benchmem -count=10
35+
36+
- name: Compare with baseline
37+
run: |
38+
go install golang.org/x/perf/cmd/benchstat@latest
39+
benchstat benchmarks/baseline.txt new.txt
40+

benchmarks/baseline.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
goos: darwin
2+
goarch: arm64
3+
pkg: github.com/operator-framework/operator-controller/test/e2e
4+
cpu: Apple M1 Pro
5+
BenchmarkCreateClusterCatalog-10 1 1352852042 ns/op 404520 B/op 3914 allocs/op
6+
BenchmarkCreateClusterCatalog-10 13 86982353 ns/op 36907 B/op 394 allocs/op
7+
BenchmarkCreateClusterCatalog-10 12 84962496 ns/op 34555 B/op 393 allocs/op
8+
BenchmarkCreateClusterCatalog-10 18 70375363 ns/op 34880 B/op 388 allocs/op
9+
BenchmarkCreateClusterCatalog-10 15 71715708 ns/op 37654 B/op 399 allocs/op
10+
BenchmarkCreateClusterCatalog-10 13 85251170 ns/op 36572 B/op 396 allocs/op
11+
BenchmarkCreateClusterCatalog-10 13 83413260 ns/op 38435 B/op 393 allocs/op
12+
BenchmarkCreateClusterCatalog-10 13 93851487 ns/op 37249 B/op 395 allocs/op
13+
BenchmarkCreateClusterCatalog-10 13 78722212 ns/op 36593 B/op 393 allocs/op
14+
BenchmarkCreateClusterCatalog-10 13 86393522 ns/op 37404 B/op 395 allocs/op
15+
PASS
16+
ok github.com/operator-framework/operator-controller/test/e2e 32.699s

0 commit comments

Comments
 (0)