We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Optimizing string usage in Go programs

Formal Metadata

Title
Optimizing string usage in Go programs
Title of Series
Number of Parts
542
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
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.