Learning Pathintermediate

Benchmarking Your Go Code

Go's built-in microbenchmarks — measure first, optimise second.

Time

~1 h

Lessons

6

Chapters

3

Assignments

3

Disable AI suggestions while you learn

This course teaches you to hand-write every line of code. Open VS Code (or your editor of choice) and turn off Copilot, Cursor Tab, Tabnine, Codeium, and any inline AI autocomplete before you start a lesson.

AI mid-completion robs you of the small mistakes that make concepts stick. You'll be a faster, more independent developer at the end of the course if you type every character yourself. Re-enable AI for your real work after — never during a lesson.

Goal of this course: learn, not ship fastest.

What you'll build

A benchmark suite for your Go service hot paths, with a baseline, a profiling workflow, and one measured optimisation.

What you'll learn

Write a Benchmark function in 10 lines
Read ns/op, B/op, allocs/op
Profile with pprof — CPU + heap
Make ONE measured change and prove the win
Compare two implementations with benchstat

Prerequisites

  • Completed Building a Go API
  • Comfortable writing Go tests

Who this is for

  • Devs guessing at performance
  • Anyone tempted to micro-optimise without data
  • Backend engineers shipping latency-sensitive features

Ready to start?

Lesson 1 takes ~6 minutes. By the end of this hour you'll be writing real code.