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" ;-) -- -j -- 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.