Profiling Your Code: 5 Tips to Significantly Boost Performance
summary
Adds a Go pprof endpoint to collect CPU, heap, block and contention profiles from production workloads, runs profiles on real traffic, and iterates: find the single biggest hotspot, fix it, profile again. Concrete fixes include zero-copy JSON and preallocated slices, stack-allocated buffers with pooled megabuffers, clearing maps instead of reallocating, multiple-size buffer pools, a reverse-index map for O(1) lookups, and string interning and bitsets to cut memory and GC pressure.
AI-written summary · about
chapters (8)
- 0:00Profiling introduction
- 2:29Why optimize fails
- 3:11Profiling data in Go
- 4:15Memory optimization in Go
- 8:31Data structure choices
- 10:59Micro-optimizations
- 16:39Log database lessons
- 17:21Applying profiling
related talks
30mSeven ways to Profile Go Applications
33mProfiling Code
26mProfiling Mastery: Decode Your Data and Elevate Observability
30mProfiling CPU and Memory on Linux, with Opensource Graphical Tools
31mProfiler: Profiling Code
19mPROMPT: A Fast and Extensible Memory Profiling Framework
50mProgram Analysis
16mMemory Allocation Profiling upcoming features
