directory

  • The preface

    • About the book
  • Chapter 1 Performance analysis

    • Benchmark Test
    • Pprof performance analysis
  • Chapter 2 Common data structures

    • String concatenation performance and principle
    • Slice performance and traps
    • For and range performance comparison
    • Reflect performance
    • Use empty structs to save memory
    • Impact of memory alignment on performance
  • Chapter 3 Concurrent programming

    • Performance comparison of read/write locks and mutex locks
    • How to Exit coroutine (Timeout scenario)
    • How to Exit coroutines (Other scenarios)
    • Controls the number of concurrent coroutines
  • Chapter 4 compiler optimization

    • Reduce compilation volume
  • Appendix Go Language traps

    • Arrays and slices

introductory

  • Go language concise tutorial
  • Go Test unit Test tutorial
  • Go Protobuf concise tutorial
  • Go RPC & TLS Authentication Tutorial
  • Go Mock (Gomock
  • Go Mmap file memory mapping tutorial
  • Go Context concurrent programming tutorial
  • Go WebAssembly (Wasm) Concise tutorial
  • Go Gin concise tutorial

Advanced series

  • Seven days with Go from zero to achieve the series
    • Web framework Gee
    • Distributed cache GeeCache
    • ORM framework GeeORM
    • RPC framework GeeRPC
    • The project address
  • Go language written interview questions
    • Basic grammar
    • Realize the principle of
    • Concurrent programming
    • Code output

The origin of the series

I’ve been using Go as my primary programming language for over a year now, developing productivity tools such as distributed compilation acceleration tools. Where performance is less sensitive, Python is often used, because Python has an advantage over other languages in text processing, and where performance is particularly sensitive, Go is used. What I admire most about Go is the concurrency of Go, coroutine plus channel, sync plus SELECT. I don’t think there’s another language where concurrency is as simple as Go.

To deepen my understanding of Go, I tried to learn about some well-known open source projects, such as the distributed cache Groupcache. There is a question on Zhihu, “What are the Go open source projects worth learning?” Groupcache is mentioned more than three times in this answer. Groupcache’s code is refined and powerful, making it a Swiss Army knife for caching. A good project must be highly respected, and learning the essence from these excellent projects is, IN my opinion, the fastest way to master a language. Therefore, I created a project called 7Days-Golang, which mimics an open source project with Go in seven days, hoping to imitate the best parts of an open source project with less than 1000 lines of code. This project has also benefited me a lot. Some programming methods and ideas I learned in this process have also made my work more interesting. Some elegant design and implementation, very little code, very high efficiency. Such as consistency hashing, single flight, etc.

Through learning some famous open source projects and Go source code, I have also mastered a lot of programming skills and know how to write to get better performance. These tips are piecemeal, and I’ve been trying to put them together in a systematic way that can be refined into a guide to high performance programming. Therefore, I started the Go language high performance programming ebook project. This project has just started and is in a process of gradual improvement.

Who is this book for?

If you are a beginner to Go, it is recommended to read the Go language tutorial, an article to understand the basic syntax of Go. This book is for kids who have been using Go as a workhorse programming language for some time and want to further improve their Go programming skills.

Recommendation and Reference

  • Go language test interview questions summary
  • Seven days with Go from zero to achieve the series

The original address: high-performance programming | Go language geek rabbit rabbit

Project Address: High-performance – Go

Attention: Geek bunny