Profiling go code a beginners tutorial

Preview:

Citation preview

Profiling Go codeA beginners tutorial

Go Stockholm Meetup #7 “High Performance Go”Dec 5th 2013

Samuel Lampa@smllmp

+samuellampasaml.rilspace.org

Developer atwww.uppmax.uu.se, www.farmbio.uu.se, rilpartner.se

Enable profiling: Standard way

Not terribly user friendly :/

… especially compared to python:

But, thanks to this Guy at Canonical(Dave Cheney) ...

● dave.cheney.net● twitter.com/davecheney

… we can now enable profiling in a much easier way:

How to run it

How to run it

How to run it

Call graph as PDF, weighted by execution time

A few more options ...

Zoomable / Scrollable SVG in browser

A few performance tricks for string processing...

Version 1

Version 2 – Table optimization

Version 3 – Using bufio Scanner(), new in Go 1.2

Version 4 – Using pointers for counters

Performance improvement, version 1-4

Creds goes to ...

● Roger Peppe, also at Canonical, for help with the optimizations, and the final optimized version!

● twitter.com/rogpeppe

Learn more

● blog.golang.org/profiling-go-programs● tinyurl.com/go-pprof-win (Using pprof on Windows)● blog.cloudflare.com/recycling-memory-buffers-in-go● saml.rilspace.org/moar-languagez-gc-content-in-pytho

n-d-fpc-c-and-c

Also, don't miss● gplus.to/golangplus● golangweekly.com

Thank you!