On Fri, 20 Oct 2017 09:09:15 -0000 Jan Mercl <0xj...@gmail.com> wrote: Jan Mercl writes: > > On Fri, Oct 20, 2017 at 11:07 AM Bakul Shah <ba...@bitblocks.com> wrote: > > > On the flip side, []*T will be less cache/TLB/GC friendly than > > []T, unless T is much larger than a ptr. You are also > > allocating an extra pointer per element. For small slices it > > probably doesn't matter much either way but when slices hold > > milions of objects.... Elements of []T are less likely to be > > mangled from random places compared to []*T as in the latter > > case you may have access through other ptrs. IO and comm will > > also be easier with []T. []*T makes sense where there is > > genuine need to share. e.g. put an object on multiple lists. > > Otherwise it can often just be premature optimization. > > That's a correct and more detailed version of "it depends on size of T" ;-)
The point is it depends on a lot more than the size of T! -- 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.