Skip to content

feat: Update benchmarking to use b.Loop() and bump go specification to 1.24 #862

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

Merged
merged 3 commits into from
Jun 17, 2025

Conversation

andrew-field
Copy link
Contributor

@andrew-field andrew-field commented Jun 12, 2025

This updates the benchmarking to take advantage of the new standard 'testing.B.Loop'. This results in simpler and more predictable benchmarking. For instance, b.ResetTimer() is no longer required. I also believe the notice

Note: Sometimes, Go can optimize your benchmarks in a way that makes them inaccurate, such as eliminating the function being benchmarked. Check your benchmarks to see if the values make sense. If they seem overly optimized, you can follow the strategies in this blog post.

no longer applies as

The compiler never optimizes away calls to functions within the body of a "for b.Loop() { ... }" loop.

See:

This request also bumps the go specification to 1.24 which is needed for this.

Thanks!

@quii
Copy link
Owner

quii commented Jun 17, 2025

Nice one!

@quii quii merged commit bf6711d into quii:main Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants