Skip to content

Commit

Permalink
add benchmark pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jianzhangbjz committed Feb 8, 2025
1 parent 38be50e commit 6ea7de2
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Benchmark Test

on:
pull_request:
branches:
- main

jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install dependencies
run: |
go mod download
go mod tidy
- name: Run benchmark
working-directory: test/e2e
run: |
pwd
ls -la
go version
go clean -testcache
go test -v -run=^$ -bench=. -benchmem -count=10
- name: Compare with baseline
run: |
go install golang.org/x/perf/cmd/benchstat@latest
benchstat benchmarks/baseline.txt new.txt
16 changes: 16 additions & 0 deletions benchmarks/baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
goos: darwin
goarch: arm64
pkg: github.com/operator-framework/operator-controller/test/e2e
cpu: Apple M1 Pro
BenchmarkCreateClusterCatalog-10 1 1352852042 ns/op 404520 B/op 3914 allocs/op
BenchmarkCreateClusterCatalog-10 13 86982353 ns/op 36907 B/op 394 allocs/op
BenchmarkCreateClusterCatalog-10 12 84962496 ns/op 34555 B/op 393 allocs/op
BenchmarkCreateClusterCatalog-10 18 70375363 ns/op 34880 B/op 388 allocs/op
BenchmarkCreateClusterCatalog-10 15 71715708 ns/op 37654 B/op 399 allocs/op
BenchmarkCreateClusterCatalog-10 13 85251170 ns/op 36572 B/op 396 allocs/op
BenchmarkCreateClusterCatalog-10 13 83413260 ns/op 38435 B/op 393 allocs/op
BenchmarkCreateClusterCatalog-10 13 93851487 ns/op 37249 B/op 395 allocs/op
BenchmarkCreateClusterCatalog-10 13 78722212 ns/op 36593 B/op 393 allocs/op
BenchmarkCreateClusterCatalog-10 13 86393522 ns/op 37404 B/op 395 allocs/op
PASS
ok github.com/operator-framework/operator-controller/test/e2e 32.699s
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ require (
github.com/Microsoft/hcsshim v0.12.9 // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -228,6 +229,8 @@ require (
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/perf v0.0.0-20250106172127-400946f43c82 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1o
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 h1:xlwdaKcTNVW4PtpQb8aKA4Pjy0CdJHEqvFbAnvR5m2g=
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
Expand Down Expand Up @@ -825,6 +827,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/perf v0.0.0-20250106172127-400946f43c82 h1:cntvEEbGexov/BId760utCq7Mtu7iJG4lRr/0z+V7Z4=
golang.org/x/perf v0.0.0-20250106172127-400946f43c82/go.mod h1:q/JkMABA9XXpcvcwKP7xYHRk8KsZBPSXrV8tG4DEMGI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down

0 comments on commit 6ea7de2

Please sign in to comment.