research!rsc: Go Data Structures
Go Data Structures
Posted on Tuesday, November 24, 2009.
When explaining Go to new programmers, I've found that it often helps to explain what Go values look like in memory, to build the right intuition about which operations are expensive and which are not. This post is about basic types, structs, arrays, and slices.
Basic types
Let's start with some simple examples:
The variable i has type int, represented in memory as a single 32-bit word. (All these pictures show a 32-bit memory layout; in ...
Read more at research.swtch.com