4 ms·
Nobody is suggesting that. Go has very good profiling support, and that's how performance optimization starts. If profiling finds that there are too many alloc
by dullgiulio 8y ago
Nobody is suggesting that. Go has very good profiling support, and that's how performance optimization starts.
If profiling finds that there are too many allocations on a hot path, you might want to see why they escape to heap. But that's a last resort strategy.
- staticassertion 8y agoThis sounds very much like "write code to please escape analysis", but with a profiling step in front of it.
- kristianp 8y agoNo, there's a difference. Profiling will often show you where you're doing allocations or calling code that does allocations in the most often used code. Profiling shows where to reduce those allocations to get the biggest improvements. When making the changes, you don't try to reduce escapes, you reduce allocations. Have a look at [1] and go down to where it says " To find out why the garbage collector is running so much". [1] https://blog.golang.org/profiling-go-programs https://blog.golang.org/profiling-go-programs