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).
• CPU profiling with pprof
• Random notes about Go’s performance.
• What I hope Go 1.5~ will have
• Sampling profiler.
• net/http/pprof provides HTTP API for
• github.com/davecheney/profile provice
easy API for CLI program.
NOTE for Mac
• Go’s CPU profiling is not work on Mac
• Russ Cox (rsc) explains why:
• And he provides kernel patch:
• Activity monitor or Instruments provides
another sampling profiler
• Included in google perftools
• ~Go 1.3 bundles CLI (perl)
• Go 1.4 has reimplement it with Go!
Things makes Go slower
• function call
• heap profile with pprof
• Provide size hint for slice and map.
• make(int, 0, hint)
• make(map[int]int, hint)
• Choose carefully string or byte
• Especially for constants
• 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.