This book provides some code performance optimization tricks, tips, and suggestions. Most of the contents in this book are made based on the official standard Go compiler and runtime implementation.
Life is full of trade-offs, the programming world is, too. In programming, we often need to make trade-offs between code readability, maintainability, development efficiency, and program efficiency, etc. Even for one of the aspects, there are also trade-offs needing to be made. Taking program efficiency for an example, we might need to make trade-offs between memory saving, code execution speed, and implementation difficulty, etc.
In practice, most parts of the code base of a project don't need to be implemented with high performances. Keeping them maintainable and readable is often more important (than making them memroy saving and run very fast). The suggestions made in this book are just for the code parts which implementations really need to be high performant. Some of the suggestions often causes more verbose code. And please note that some of the suggested implementation might only be performant at some certain scenarios, and might be not at others.
The contents in this book include:
how to consume less CPU resources. how to consume less memory. how to make less memory allocations. how to control memory allocation places. how to reduce garbage collection pressure.
This book neither explain how to use performance analysis tools, such as pprof, nor try to study deeply on compiler and runtime implementation details. None of the contents provided in this book make use of unsafe pointers and cgo. The contents in this book also doesn't talk about algorithms. In other words, this book tries to provide some optimization suggestions in a way which is clear and easy to understand, for daily general Go programming.
The content is interesting but I've never read a book with so many typos and mistakes. It completely destroyed my reading experience to face at least one mistake per page (and I'm reading on Kindle with a large font). Also, the argument from the author on Reddit to say "but it's an open book and you can edit it on Github" doesn't count. I'm buying a book, it isn't a free one. So it's not up to me to spend hours fixing all the mistakes of the authors, I'm not paid for that. Clearly, the last book I'll buy from this author.
Most of the examples are about super rare compiler optimizations and most of the time you will not need to do such things, but the content itself it’s really useful and interesting. This is the second time I read it, now with the recent update for 1.23
Being not a native English speaker, the book fascinated me with the number of grammatical and vocabulary mistakes. The content is good though. If you can tolerate the mistakes and know why you are reading it, then I recommend this book