> type User struct { > ID string > Name string > Location loc > } > *Considering the situation, I do not have to change data for Owner or > Player after creating value for Games above and Player can sometimes remain > Nil, should I use only User or it's better to use *User* > > > I have following confusion based on above 2 cases > > > 1. Performance - which one is better & why? > 2. Garbage Collection - which one is better & why? > 3. Any Memory effects? > 4. Any other effects! > > 1. B: User is a small struct, pointers mean GC pressure, so use User, if possible. 2. B 3. B 4. If you have to modify a User and see the change everywhere (i.e. an Owner is a Player, too) then use a pointer (*User), or have a global map[User.ID]User and identify each user by its ID.
If you can, go without a pointer. -- 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.