Courses
Go Advanced: Performance, Concurrency, and Production
Check Yourself
Five scenario questions on go test -bench, -benchmem, slice pre-sizing, and sync.Pool.
Course content
Join this Course
Sign in to save your progress.
-
Bounded Concurrency and Worker Pools
-
Bound Concurrency With a Worker Pool
-
Coordinate Shared State With sync.Mutex and atomic
-
-
-
Memory, Allocations, and Benchmarking
-
Measure Speed and Allocations With go test -bench
-
Cut Allocations With Pre-Sizing and sync.Pool
-
-
-
Profiling and Diagnostics
-
Find CPU and Heap Hotspots With pprof
-
Catch Goroutine Leaks and Slow Tests Early
-
-
-
Resilience and Defensive HTTP
-
Add Retries With Backoff and Jitter
-
Protect Endpoints With Rate Limiting and Panic Recovery
-
-
-
Production Builds and Containers
-
Embed Static Assets and Version Info With embed and ldflags
-
Ship a Multi-Stage Scratch Go Container
-
-
-
Fuzzing, GC Tuning, Tracing, and Reflection
-
Fuzz Testing Parsers and Decoders With go test -fuzz
-
Escape Analysis and GC Tuning (-gcflags="-m", GOGC, GOMEMLIMIT)
-
Execution Tracing and Block/Mutex Contention Profiling
-
Reflection, Struct Tags, and go generate
-
-
1.
In our benchmark, `JoinPlus` took `16895 ns/op` with `200 allocs/op`, while `JoinBuilder` took `916.2 ns/op` with `9 allocs/op`. Why?
2.
Which `go test` flag adds `B/op` and `allocs/op` to benchmark output?
3.
Why did `s := make([]int, 0, 256)` drop `256` appends from `9 allocs/op` down to `0 allocs/op`?
4.
When borrowing a `*bytes.Buffer` from a `sync.Pool`, what must you do before writing to it?
5.
Why should you prefer `for b.Loop()` over `for i := 0; i < b.N; i++` in Go 1.24+ benchmarks?
About
Five scenario questions on go test -bench, -benchmem, slice pre-sizing, and sync.Pool.
- Duration
- 5 min
- Last update
- 11/27/2026
Was this helpful?
0
0
Comments
Sign in to commentNo comments yet.