3 hours ago · Tech · 0 comments

So far in this series we’ve looked at the parts of the Go runtime that orchestrate execution — the memory allocator, the scheduler, the garbage collector, sysmon, the netpoller. Today we’re switching gears and looking at three of the most ordinary things in Go: slices, maps, and channels. They are the bread and butter of every Go program. You probably write all three of them several times before lunch. But “ordinary” is doing a lot of work in that sentence. None of these are language primitives in the way an int is — they all have real, non-trivial data structures behind them, allocated on the heap, managed by the runtime, and tuned aggressively for performance. The syntax (s[i], m[k], <-ch) hides all of that, and that’s the point. But once you peel the syntax back, what’s actually sitting in memory? That’s the question we’re going to answer.

No comments yet. Log in to reply on the Fediverse. Comments will appear here.