Continuous Benchmarks in GO
GO provides simplistic way to write benchmarks for your code.
I am going to share how to efficiently integrate benchmarks in GO with continuous integration.
I will walk you through the essentials of continuous benchmarks in GO, empowering you to track your code for performance regression using an example of tracking memory consumed per operation for GO.
I have chosen GO for illustration here. And, same technique can be adapted for any other language or memory profiler.
Purpose of continuous benchmarks
- Performance regression for early detection
- Historical data to track down
- Comparisons to identify slow parts
1 Performance regression
It is easy to just write the benchmark command to your Github Action workflow. However, this is not enough to track down and detect any performance regressions or improvements over time.
When reviewing pull requests, the benchmarks can be easy forgotten to check.
The same is published as a PR comment when using the action on Github, which we talk about later in this guide.
2 Historical data