High Performance Go

The goal for this workshop is to give you the tools you need to diagnose and fix performance problems in your Go applications.

Through the day we work from the small — learning how to write benchmarks, then profiling a small piece of code. Then step out and talk about the execution tracer, the garbage collector and tracing running applications. The remainder of the day will be a chance for you to ask questions, experiment with your own code.

This workshop is available in full day and half day lengths.

Syllabus

  • Benchmarking

    How to write effective benchmarks, and how to interpret their results. This section includes some traps for young players and advice for how to avoid them.

  • Profiling

    How to use the tools built into the Go runtime, and other tools like perf(1) to gain an understanding on what your code is doing.

  • Compiler optimisations

    The Go compiler performs many of the classical optimisation passes found in modern compilers. This section will discuss the operation of the three most important ones; inlining, escape analysis, and dead code elimination.

  • Understanding the execution tracer

    Unlike sample based profiling, the execution tracer is integrated into the Go runtime, so it doesn’t just know what a Go program is doing at a particular point in time, but why. This section will demonstrate the usage and interpretation of the results from, the execution tracer.

  • Memory management and GC tuning

    As Go is a garbage collected language, understanding, and working with the garbage collector is a large part of writing performant applications.

  • Concurrency

    The final section focuses on using (and not overusing) Go’s concurrency features.

After each section there will be ample time for questions from the students.

Once all the sections are complete the remainder of the time will be dedicated to assisting the students in applying the material to their own projects.

Prerequisites

  • Each student must provide their own laptop with a current working Go environment.

Outcomes

At the end of the day you will be able to

  • Write reliable benchmarks.
  • Profile existing programs.
  • Identify common bottlenecks.
  • Address performance bottlenecks and measure the result.

Who should attend

  • Familiarity with the Go programming language is assumed. This is not an introductory course on Go programming.
  • Students should have written and deployed a Go application to production.

Materials:

Sample

All training materials are supplied under a CC-SA 4.0 licence