Re: [go-nuts] Assigning struct values

2022-09-08 Thread Martin Schnabel
Hi Mustafa, this can be easy if you put a pointer value of type *TypeOfStruct into the interface. interface values of structs end up using pointers underneath anyway so there is no performance reason not to. The explanation is that if you type assert to TypeOfStruct, you copy out that plain s

Re: [go-nuts] Re: Confused about heap usage for empty slices

2022-09-08 Thread 'Axel Wagner' via golang-nuts
There is a theoretical (but literally negligible in practice) difference in that the compiler has to write the pointer into the slice. But yes, realistically, there is no difference. On Thu, Sep 8, 2022 at 4:15 PM Mathew Murphy wrote: > Thanks. So basically, there's no memory benefit or performa

[go-nuts] Re: Confused about heap usage for empty slices

2022-09-08 Thread Mathew Murphy
Thanks. So basically, there's no memory benefit or performance benefit to using nil slices over empty slices -- it's ultimately just a matter of how you want them to serialize JSON or get written to databases? mathew On Wednesday, September 7, 2022 at 6:56:33 PM UTC-5 k...@google.com wrote: >

Re: [go-nuts] Understanding the mutex.TryLock return false when the mutex is unlocked based on the memory model

2022-09-08 Thread Ian Lance Taylor
On Thu, Sep 8, 2022 at 5:05 AM Benz wrote: > > There are two cases in mutex.TryLock could return false > > the lock is currently held by another goroutine. > the lock is not held but the mutex is in starvation mode; i.e., the lock will > be handed off to the next waiter. > > However, Per The Go m

[go-nuts] go.dev website

2022-09-08 Thread jamesl...@gmail.com
I found the https://go.dev marketing site is serving from US location which is a long distance to Asia, I could imagine some developers on slow network connectivity will experience slow loading site in those regions. I don't have the data for that since I'm in Singapore, but it could be useful f

[go-nuts] Understanding the mutex.TryLock return false when the mutex is unlocked based on the memory model

2022-09-08 Thread Benz
There are two cases in mutex.TryLock could return false - the lock is currently held by another goroutine. - the lock is not held but the mutex is in starvation mode; i.e., the lock will be handed off to the next waiter