Skip to content
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 note on potential go benchmark optimisations #781

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

PatrickWMartin
Copy link

To address issue #694, I added a note warning that Go can sometimes optimize functions being benchmarked, leading to inaccurate results. From research this issue seems to be rare, but it is probably still a good idea to warn users about it. There are several related issues in the Go repository, and people are looking for guidance from the Go team. I believe a warning is sufficient for now, as the benchmarks in the lesson follow the same practices as those in the Go documentation and most other codebases. However, this may need to be revisited in the future if best practices change. I linked a blog post from Dave Cheney in the warning so that people could read more and see how to address this issue if it comes up for them.

Note was italicized and didn't have a colon. This didn't match the other case of a note
in the itegers chaper which was.
Added a note on go optimizing benchmarks and a link to Dave Cheney's blog post
on how to write benchmarks for how to make sure it doesn't. This optimization seems
rare from reading issues online but does happen so warning would be good to let people know.
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.

1 participant