(no title)
jfoutz | 1 year ago
Look past the "loading the whole book in memory" the author gets to the point soon enough.
The ip address example is ok. It's true, and highlights some important points. But keep in mind pointers are 64 bit. If you're not ipv6, and you're shuffling a lot of them, you're probably better off just keeping the uint64 and converting to string and allocating the struct as needed. interning doesn't appear to be much of a win in that narrow case. but if you do care about ipv6, and you're connecting to millions of upstreams, it's not unreasonable.
It's neat it's available. it's good to be aware of interning, but it's generally not a huge win. For a few special cases, it can be really awesome.
** edit uint32 for ipv4. bit counting is hard.
wjholden|1 year ago
https://cs.opensource.google/go/go/+/refs/tags/go1.23.1:src/...
This is called an IPv4-Mapped Address.
https://www.rfc-editor.org/rfc/rfc5156#section-2.2
oefrha|1 year ago