Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6ea7de2

Browse files
committedFeb 8, 2025·
add benchmark pipeline
1 parent 38be50e commit 6ea7de2

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-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+
go mod tidy
26+
27+
- name: Run benchmark
28+
working-directory: test/e2e
29+
run: |
30+
pwd
31+
ls -la
32+
go version
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

‎go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ require (
5555
github.com/Microsoft/hcsshim v0.12.9 // indirect
5656
github.com/VividCortex/ewma v1.2.0 // indirect
5757
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
58+
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 // indirect
5859
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
5960
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
6061
github.com/beorn7/perks v1.0.1 // indirect
@@ -228,6 +229,8 @@ require (
228229
golang.org/x/crypto v0.32.0 // indirect
229230
golang.org/x/net v0.34.0 // indirect
230231
golang.org/x/oauth2 v0.25.0 // indirect
232+
golang.org/x/perf v0.0.0-20250106172127-400946f43c82 // indirect
233+
golang.org/x/sync v0.10.0 // indirect
231234
golang.org/x/sys v0.29.0 // indirect
232235
golang.org/x/term v0.28.0 // indirect
233236
golang.org/x/text v0.21.0 // indirect

‎go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1o
5050
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
5151
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
5252
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
53+
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 h1:xlwdaKcTNVW4PtpQb8aKA4Pjy0CdJHEqvFbAnvR5m2g=
54+
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY=
5355
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
5456
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
5557
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
@@ -825,6 +827,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr
825827
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
826828
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
827829
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
830+
golang.org/x/perf v0.0.0-20250106172127-400946f43c82 h1:cntvEEbGexov/BId760utCq7Mtu7iJG4lRr/0z+V7Z4=
831+
golang.org/x/perf v0.0.0-20250106172127-400946f43c82/go.mod h1:q/JkMABA9XXpcvcwKP7xYHRk8KsZBPSXrV8tG4DEMGI=
828832
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
829833
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
830834
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

0 commit comments

Comments
 (0)
Please sign in to comment.