-
Notifications
You must be signed in to change notification settings - Fork 89
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
refactor performance test to be standard golang benchmarks #432
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Thanks for doing this! This is nitpicking, but it appears these benchmarks could be consolidated as sub-benchmarks parameterized by user and token counts i.e., something like this: func BenchmarkCache(b *testing.B) {
for _, bm := range []struct {
users, tokens int
}{
{100, 10_000},
} {
b.Run(fmt.Sprintf("%d users %d tokens", bm.users, bm.tokens), func(b *testing.B) {
// inline benchmark() and perhaps also queryCache()
})
}
} ...which would be tidier. I haven't tried it though, maybe there's a catch. What do you think? |
Great idea, I agree that’s better |
Would be nice to integrate with https://github.com/benchmark-action/github-action-benchmark |
Do we still want to merge this in? |
I wouldn't block anything on it but I think we should merge this (after tidying it up into sub-benchmarks as I described above). It's weird to benchmark with a unit test printing to console instead of go's standard benchmarking framework. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@chlowell Done, ready for review |
Co-authored-by: Charles Lowell <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Fixes #433
Go has built in benchmarking feature https://pkg.go.dev/testing#hdr-Benchmarks
Example output