Mechanical Sympathy in Go

Image for post
Image for post

A couple of months ago, I wrote a post about Go and CPU Caches: https://teivah.medium.com/go-and-cpu-caches-af5d32cc5592

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:

https://www.youtube.com/watch?v=cetmDfqr2BU

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

Written by

Software Engineer, Go, Rust, Java | 改善

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store