Mechanical Sympathy in Go

Teiva Harsanyi
Nov 20, 2020


A couple of months ago, I wrote a post about Go and CPU Caches:

Then, I wanted to extend the scope of this post. Following this idea, I had the chance to give a talk to GopherCon Turkey 2020. The topic is the following: Mechanical Sympathy in Go.

I tried to cover the following topics:

  • CPU architecture introduction
  • Locality of reference principles: temporal vs spatial locality, predictability, striding
  • Data-oriented design: introduction, slice of structs vs struct of slices, etc.
  • Pitfalls due to a bad utilization of CPU caches: cache associativity, critical stride
  • Concurrency: false sharing

Here is the video of my talk:

The beginning of the talk was unfortunately ousted. Yet, you can find the slides here for the missing introduction:

Follow me on Twitter @teivah



Teiva Harsanyi

Software Engineer @Google | 馃摉 100 Go Mistakes author | 鏀瑰杽