TGViewer
Go Library Go Library @golanglibrary · 4.38K subscribers
Post #1544 312
Hacking the Go compiler to efficiently map IPv4 to IPv6

There is no Map() or To6() method for the reverse direction. Such a method is trivial to implement, but Go maintainers have rejected it on the grounds that users should write netip.AddrFrom16(ip.As16()) and let the compiler optimize it. Today, this pattern is eight times slower than a native method. How can we teach the compiler to optimize this sequence?


https://vincent.bernat.ch/en/blog/2026-go-netip-addrto6
More from @golanglibrary
  1. Oct 14, 2026Every Go release since 2013, benchmarked: go1.2 to go1.27 We measured the fastest Benchmar…
  2. Oct 13, 2026Hooking into the Go Toolchain Today we're going to take a look at the Go toolchain, and mo…
  3. Oct 12, 2026The Data Race That Wasn't a Bug (and the One That Was) The race is between your code and a…
  4. Oct 11, 2026terratest Terratest is a Go library that makes it easier to write automated tests for your…
  5. Oct 10, 2026NATS NATS is a simple, secure and performant communications system for digital systems, se…
  6. Oct 9, 2026Hister | Your Own Search Engine Hister turns the pages you visit and the files you keep in…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →