New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Go benchmark test #3004
Add Go benchmark test #3004
Conversation
|
See the benchmarks test duration: |
Codecov Report
@@ Coverage Diff @@
## main #3004 +/- ##
===========================================
+ Coverage 40.17% 61.01% +20.83%
===========================================
Files 166 289 +123
Lines 20713 24548 +3835
===========================================
+ Hits 8322 14978 +6656
+ Misses 11580 7941 -3639
- Partials 811 1629 +818
Flags with carried forward coverage won't be shown. Click here to find out more.
|
.github/workflows/go.yml
Outdated
| - name: Check-out code | ||
| uses: actions/checkout@v2 | ||
| - name: Run Go benchmark test | ||
| run: go test -run '^$' -bench . -benchtime 1s -timeout 10m -cpu 4 -v -benchmem ./pkg/... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 1s instead of 1x? do you need to run each benchmark more than once? I think 1s is actually the default for -benchtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 1s is the default for -benchtime, 1x is more reasonable.
src/testing/benchmark.go
func initBenchmarkFlags() {
matchBenchmarks = flag.String("test.bench", "", "run only benchmarks matching `regexp`")
benchmarkMemory = flag.Bool("test.benchmem", false, "print memory allocations for benchmarks")
flag.Var(&benchTime, "test.benchtime", "run each benchmark for duration `d`")
}
var (
matchBenchmarks *string
benchmarkMemory *bool
benchTime = durationOrCountFlag{d: 1 * time.Second} // changed during test of testing package
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Run the benchmarks once for each PR. Fixes antrea-io#2984 Signed-off-by: Wenqi Qiu <wenqiq@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but we need to merge #2994 first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/skip-all |
|
/skip-e2e |
Run the benchmarks once for each PR. Fixes antrea-io#2984 Signed-off-by: Wenqi Qiu <wenqiq@vmware.com>
Run the benchmarks once for each PR.
Fixes #2984
Signed-off-by: Wenqi Qiu wenqiq@vmware.com