My understanding is that a slice is an array of pointers. So your []struct{} is
essentially an array of pointers to the structs. Your []*struct{} is an array
of pointers to pointers to the structs. In terms of memory allocation, both
should be similar. For every modification, a new array is created and the
pointers are copied.
If you don't need random access, linked list should be more efficient. However,
slice is cheap. Unless you are dealing with a large number of items, the
difference may not be substantial.
I am no expert, so I may be wrong about this.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.