Continuous Benchmarks in GO

pulkit kathuria
web-developer
Published in
4 min readMay 19, 2024

--

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

  1. Performance regression for early detection
  2. Historical data to track down
  3. 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.

Memory usage per operation comparsison between 2 branches — for feature get-likes per operation. Image by Author: Using CoverItUp — All in one code coverage tool

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

--

--

web-developer
web-developer

Published in web-developer

Web Developer. HTML/CSS/JS/PHP/Mysql. Share tips and knowledge from your experience working in Enterprise Tech Companies

pulkit kathuria
pulkit kathuria

Written by pulkit kathuria

If it is on the internet already, I won’t write about it. Just sharing novel items that I discover during work and find worth sharing.

No responses yet