And I m gopher • I love Go. It’s more Pythonic than Python! • Explicit is better than implicit. • Simple is better than complex. • Readability counts. • There should be one-- and preferably only one --obvious way to do it. • Although that way may not be obvious at first unless you're Dutch (Gopher).
Today • CPU profiling with pprof • Random notes about Go’s performance. • What I hope Go 1.5~ will have
Let s use it • top • web (svg) • list, disasm, and weblist
Random notes about Go s performance
Things makes Go slower • GC • memcpy • function call
GC • GODEBUG=gctrace=1 • heap profile with pprof • sync.Pool • Provide size hint for slice and map. • make(int, 0, hint) • make(map[int]int, hint) • GOGC=400
memcpy • Choose carefully string or byte • Especially for constants
function call • Go’s calling convention is much slower than C. • No pass by register • All register are volatile • hook for runtime. • But Go has inlining • small leaf function may be inlined • Not inlined func may not have hook, too.