Re: [go-nuts] Re: slice of pointer of struct vs slice of struct

2017-10-22 Thread Henrik Johansson
No, you are right but then I have made an explicit decision that state is important and mutable so hopefully I would take that into consideration when exposing the data. lör 21 okt. 2017 kl 13:00 skrev Juliusz Chroboczek : > > I have started to use non pointer slices much more as of late. > > Eve

Re: [go-nuts] Re: slice of pointer of struct vs slice of struct

2017-10-20 Thread roger peppe
If I need to mutate elements of an array of by-value structs, I'll usually do this: https://play.golang.org/p/YUFsOkvKQ4 Then for most of the body of the loop, you can use i and t as if you'd ranged over pointers to elements of the slice (no need to explicitly assign to the element). On 20 Octob

Re: [go-nuts] Re: slice of pointer of struct vs slice of struct

2017-10-20 Thread Henrik Johansson
https://play.golang.org/p/xILWETuAii I have started to use non pointer slices much more as of late. Every time I bother measuring it is always faster and it is better for the GC (usually, caveats apply). It also, perhaps naively, feels safer... :) fre 20 okt. 2017 kl 13:41 skrev Juliusz Chrobocz