Chapter 1

Microbenchmarks 101

BenchmarkXxx, b.N, and what the output means.

~13 min total2 lessonsAssignment

By the end of this chapter you'll be able to

  • Write your first benchmark
  • Read ns/op and allocs/op without lookup

Chapter assignment

Benchmark a hot path

Pick the most-called function in your service (often a serialiser, parser, or auth check). Write a benchmark. Run it 3 times and confirm the numbers are stable. Paste the output in notes.md.

See success criteria

Lesson 1 takes ~7 min.

Start chapter

Spot a typo? Have an idea?

Help us improve this chapter. One click opens a GitHub issue with this chapter's URL pre-filled — suggest a clearer wording, report a bug, or request a new lesson. The course keeps improving thanks to learners like you.

Suggest an improvement on GitHub