~/talk

Obscure Go Optimisations

Talkat GopherCon UK 2022 · 2022-08-16..08-18· [go]
slides:none on file

Shows how a hidden conversion silently allocates when Go casts a slice to an interface, causing Prometheus startup to do a million allocations and lose ~25% (profile showed a mystery confTslice allocating, then fix hoists a pointer out of the loop and removes GBs of allocation). Demonstrates profiler + flamegraph to find it, switching from interface calls to a function or type-parameterized compare, using PDQ sort and golang.org/x/slices for big wins, and replacing heat-ballast with GOMEMLIMIT + GOGC=off to drop GC frequency (example: GC rate 150→30 Hz and latency ~55ms→<40ms).

AI-written summary · about

  1. 0:00Introduction and Background
  2. 5:43Identifying Performance Issues
  3. 13:26Optimizing Memory Allocation
  4. 19:06Sorting and Interface Overhead
  5. 25:48Generic Functions for Speed
  6. 32:26Understanding Garbage Collection
  7. 40:01Heap Management Techniques
  8. 45:02Conclusion and Key Takeaways
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.