📂 Minimize allocations in Go
A collection of tips for when you need to minimize the number of allocations in your Go programs.
Use the go profiler to identify which parts of your program are responsible for most allocations.
Most of these tricks cause a tradeoff between reducing memory allocations and other aspects (including e.g. higher peak memory usage, higher CPU usage, lower maintainability, higher probability of introducing subtle bugs). Only apply these tricks if the tradeoff in every specfic case is globally positive.