Hi 👋
My name is Bartek PÅ‚otka and I wrote "Efficient Go". This book teaches pragmatic approaches to software efficiency and optimizations. While the majority of the learnings works for any programming language, it's best to learn on specific examples. For that purpose I teach how to make my favorite language more efficient - Go.
In this open-source repository you can find all examples from the book with tests, additional comments and more! Play with the examples to learn more about CPU, memory, OS and Go runtime characteristics I explained in my book!
NOTE: Don't import this module to your production code--it is meant for learning purposes only. Instead, we maintain production grade utilities mentioned in the book in core and e2e modules.
All examples from the book are buildable and tested in CI (as they should). See their location in the below table. For most of the code there exists corresponding _test.go
file with tests and microbenchmarks when relevant.
For the book version before errata, see v1.0 branch.
NOTE: Some function names in examples might be different in book vs in code, due to name clashes. Code in the book might be also simplified. I also use non-conventional naming convention with some functions e.g.
FailureRatio_Better
. In Go all names should have camelCase form, so e.g.FailureRatioBetter
. However, I chose to keep underscore to separate different versions of the same functions for book purposes - so the "production name" should is stillFailureRatio
! (:
Copyright Bartek PÅ‚otka