Strings can seem like one of the most innocuous data structures in Go. Yet, they still play a significant role in most ubiquitous types of programs, such as text processors, in-memory key-value stores, DNS resolvers, or codecs. Their burden on the performance of such programs becomes especially pronounced in distributed systems and cloud-native environments, where the number of strings within an instance of the software can reach an order of millions or more. This gives rise to performance issues and bottlenecks, especially with regard to memory consumption.
To provide answers to these problems, the talk will discuss several string-optimization techniques. To be more accessible for both beginner and intermediate levels, the talk will first state the problem and briefly introduce strings as a data structure, and will explain how strings look internally in Go. The core of the presentation will be dedicated to discussing operations with strings and how these can be optimized based on various techniques, such as string interning and string concatenation. The author will also share his experience and practical examples of open-source programs, where these techniques are being applied.
Speakers: Matej Gera