Two new books, Go Optimizations 101 and Go Details & Tips 101, are published now.

Go Optimizations 101

This book provides some code performance optimization tricks, tips, and suggestions, which include

Go Optimizations 101

(about 150 pages, 75+ facts and suggestions)

The digital versions of this book are available at the following places:

(Please note that the current price $5.99 is available for a limited period only. The price will be raised to $9 in a few days.)

Tapir, the author of Go 101, has spent 5+ years on writing Go 101 series books and maintaining the go101.org website. New contents will be continually added to the book series and the website from time to time. Tapir is also an indie game developer. If you would like to, you can support the book and the website by playing Tapir's games (made for both Android and iPhone/iPad).

Thanks to Olexandr Shalakhin for the permission of using one of the wonderful gopher icon images in the book cover.

Index:

  • Acknowledgments
  • About Go Optimizations 101
  • Value Parts and Value Sizes (avaliable in the paid ebooks)
    • value/type sizes
    • memory alignments
    • struct padding
    • avoid larger copy costs
  • Memory Allocations
  • Stack and Escape Analysis (avaliable in the paid ebooks)
    • escape analysis
    • how to control value allocation places
    • stacks growth and shrinkage
    • how to reduce stack grow times
  • Garbage Collection (avaliable in the paid ebooks)
    • GC pacer
    • how to reduce GC pressure
    • control GC frequency
  • Pointers
  • Structs (avaliable in the paid ebooks)
    • 3 facts/suggestions
  • Arrays and Slices (avaliable in the paid ebooks)
    • 11 facts/suggestions
  • String and Byte Slices (avaliable in the paid ebooks)
    • 10 facts/suggestions
  • BCE (Bound Check Eliminate) (avaliable in the paid ebooks)
    • the cases BCE works for
    • the cases BCE doesn't work for
    • the cases BCE works for when given hints
  • Maps
  • Channels (avaliable in the paid ebooks)
    • 3 facts/suggestions
  • Functions (avaliable in the paid ebooks)
    • how to make a function inline-able
    • how to make a function not inline-able
    • pointer parameters/results vs. non-pointer ones
    • named results vs. annonymous ones
    • 10+ facts/suggestions
  • Interfaces (avaliable in the paid ebooks)
    • value boxing costs
    • 3+ facts/suggestions

The Go 101 project is hosted on Github. Welcome to improve Go 101 articles by submitting corrections for all kinds of mistakes, such as typos, grammar errors, wording inaccuracies, description flaws, code bugs and broken links.

If you would like to learn some Go details and facts every serveral days, please follow Go 101's official Twitter account @go100and1 or join Go 101 slack channels.

Tapir, the author of Go 101, has been on writing the Go 101 series books and maintaining the go101.org website since 2016 July. New contents will be continually added to the book and the website from time to time. Tapir is also an indie game developer. You can also support Go 101 by playing Tapir's games (made for both Android and iPhone/iPad):
Individual donations via PayPal are also welcome.