Well, talking about faults in the stdlib opens a whole can of worms. There 
is more than a few in there that have code that is quite non-idiomatic, and 
some needs serious optimisation... And while there is a clear aim to not 
unnecessary complicate the compiler, I think there is a lot that can be 
said for bringing more of these APIs up to date with the best practices 
found in the use of the language.

I have been watching this thing about bounds check elimination. It's a nice 
trick but there needs to be some solution to how to reduce BCs more 
efficiently automatically. Perhaps an extension to gofmt? A lotta stuff in 
go has to be implemented with slice iteration so bounds checks are a big 
unnecessary overhead in some parts of code everywhere.

I'm writing a bitcoin-based server at the moment, and its replay 
performance, script engine, etc, all need to be dramatically optimised (the 
code is quite stable), as it is more than 10x slower than bitcoin core. I'd 
say BC's are part of that.

Anyway, back to more on topic, it would be good to see some project start 
up with the intention of tightening up the go standard library. It's a 
phenomenal piece of work, I'm not saying it's bad, but Go's main downsides 
stem from several of its safety features, which need to be relaxable 
sometimes and probably are harbouring wasteful overheads here and there in 
places.

On Thursday, 2 May 2019 23:44:25 UTC+2, John Dreystadt wrote:
>
>
>
>
>
> On Thursday, 2 May 2019 14:09:09 UTC+2, Louki Sumirniy wrote:
>>
>> The function has a very specific purpose that I have encountered in 
>> several applications, that being to automatically set the netmask based on 
>> the IP being one of the several defined ones, 192, 10, and i forget which 
>> others. 
>>
>> Incorrect netmask can result in not recognising a LAN address that is 
>> incorrect. A 192.168 network has 255 available addresses. You can't just 
>> presume to make a new 192.168.X... address with a /16, as no other 
>> correctly configured node in the LAN will be able to route to it due to it 
>> being a /16. 
>>
>> If you consider the example of an elastic cloud type network environment, 
>> it is important that all nodes agree on netmask or they will become 
>> (partially) disconnected from each other. An app can be spun up for a few 
>> seconds and grab a new address from the range, this could be done with a 
>> broker (eg dhcp), but especially with cloud, one could use a /8 address 
>> range and randomly select out of the 16 million possible, a big enough 
>> space that random generally won't cause a collision - which is a cheaper 
>> allocation procedure than a list managing broker, and would be more suited 
>> to the dynamic cloud environment.
>>
>> This function allows this type of client-side decisionmaking that a 
>> broker bottlenecks into a service, creating an extra startup latency cost. 
>> A randomly generated IP address takes far less time than sending a request 
>> to a centralised broker and receiving it.
>>
>> That's just one example I can think of where a pre-made list of netmasks 
>> is useful, I'm sure more experienced network programmers can rattle off a 
>> laundry list.
>>
>>
> While I kind of see your point, it still seems odd that you want a 
> function for this that is in the main net package. I would expect most if 
> not all applications doing dynamic assignment to pick one address range and 
> then use a fixed netmask. I just think that very few programmers will need 
> such a function so I don’t think Go, with its emphasis on simplicity, so 
> have it. 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golan...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to