[HN Gopher] Netaddr.ip: a new IP address type for Go
       ___________________________________________________________________
        
       Netaddr.ip: a new IP address type for Go
        
       Author : smitop
       Score  : 54 points
       Date   : 2021-03-10 21:33 UTC (1 hours ago)
        
 (HTM) web link (tailscale.com)
 (TXT) w3m dump (tailscale.com)
        
       | nynx wrote:
       | What an insane amount of work for something that would be fixed,
       | in a better language, by better value types and algebraic enums.
        
       | tkiolp4 wrote:
       | Year and a half of work. Impressive. I wonder if it's actually
       | worth it for a company to spend such amount of time on stuff like
       | this. Nevertheless, I really appreciate it's open source.
        
       | gigatexal wrote:
       | I trust Brad and the team's take on things. If they decide they
       | needed a new library for this then so be it.
        
       | loa_in_ wrote:
       | > [it improves upon] 28-56 bytes [of IPv4 record size]
       | 
       | that's still 28-56 MiB for 1024000 (~1M) IP records. Who needs to
       | manipulate more than that?
        
         | hawski wrote:
         | You should also think in terms of CPU caches.
        
         | tylersmith wrote:
         | Well they manage around 500 addresses for me, and I assume
         | they'd like more than 2k users like me some day.
        
           | dave_universetf wrote:
           | Also, we run on platforms like iOS, where we have very severe
           | memory constraints (the NetworkExtension is allowed 15MiB of
           | total RAM). Given that we juggle a lot of IP-related data
           | types, even modest optimizations help.
           | 
           | That said, I'd think of the size thing as more of a
           | constraint on the other desired features. We wanted the other
           | nice things (less GC pressure, no allocations, comparable
           | type...) while also being _lean enough_ that there's no
           | reason not to use the netaddr types.
        
         | gjulianm wrote:
         | Network code tends to be performance critical, so the more you
         | can fit into a cache line the better. Exact numbers depend on
         | the application, of course, but those memory overheads can give
         | you a very serious performance hit in cache-heavy applications.
        
         | centimeter wrote:
         | Web infrastructure companies keeping track of hundreds of
         | millions of users.
        
         | jerf wrote:
         | Google, Cisco, Microsoft, AWS, Linux, OpenBSD, ...
         | 
         | ... Tailscale...
         | 
         | You may not be in the class. I only live next to people in that
         | class, I'm not in it myself. But it exists.
        
         | petee wrote:
         | Size is a bonus though, the primary push seems to be all the
         | other issues. Either way imho, needless bloat should be shorn
         | regardless of the ability to accommodate it.
        
       ___________________________________________________________________
       (page generated 2021-03-10 23:00 UTC)