Performance and Profiling
Part of the Go course
At some point someone says the service is slow, and you open the code and immediately spot the loop that must be responsible. You rewrite it, it is much cleverer now, and the service is exactly as slow as before, because the actual cost was in a JSON encode three functions away that nobody thought about.
This happens to everyone, repeatedly, and it is not a failure of skill. Programs spend their time in places human intuition is bad at predicting, because the compiler, the garbage collector, and the CPU's caches are all making decisions you did not write. The only reliable way through is to measure, change one thing, and measure again. ...
Want to learn Go Performance and Profiling in a real environment?
Click below, get a fresh Linux box with Go ready to go, and work through Performance and Profiling hands-on with an AI tutor that knows your code.
Start this lessonPerformance and ProfilingWhat you'll learn
- Go test -bench
- Pprof CPU and heap profiles
- Escape analysis with -gcflags=-m
- Avoiding unnecessary allocations
- Preallocating slices
- Sync.Pool intuition
Read this lesson in your language
All lessons in this course
20 lessons- 1Hello, Go25 min
- 2Variables and Types25 min
- 3Control Flow: if and for30 min
- 4Functions30 min
- 5Slices and Maps35 min
- 6Structs and Pointers35 min
- 7Methods and Interfaces35 min
- 8Error Handling35 min
- 9Modules and Project Structure35 min
- 10Tiny CLI Capstone40 min
- 11A Tour of the Standard Library40 min
- 12Testing and Benchmarks40 min
- 13Goroutines and Channels40 min
- 14Concurrency Patterns45 min
- 15Generics35 min
- 16HTTP Servers45 min
- 17Databases with database/sql45 min
- 18Performance and Profiling40 min
- 19Design Patterns in Go40 min
- 20Deployment and Production45 min
