How to benchmark your Go code

Arpit Bhayani

Arpit Bhayani

Dec 04, 2023 • 1 min read


How to benchmark your Go code? ⚡

Go comes with a built-in benchmarking framework that gives you the ability to benchmark any code and it reports some interesting stats like

  • function throughput
  • per operation execution time
  • number of allocations per operation
  • total memory allocation per operation

I wrote a detailed post on Duggup about how to use this framework, benchmark the code, and a few tunable parameters.

Read it here - https://lnkd.in/gCnssyP9

This was Day #3 of the 30 days of Go challenge, so follow along my journey and share your learnings on Duggup - a no-nonsense social network for people in tech.

⚡ I keep writing and sharing these engineering nuggets, so if you are keen on learning them, follow along.

duggup.com/p/arpit

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses