On Thu, Sep 8, 2016 at 7:21 AM, T L <tapir....@gmail.com> wrote: > > On Thursday, September 8, 2016 at 9:48:34 PM UTC+8, Jan Mercl wrote: >> >> On Thu, Sep 8, 2016 at 3:32 PM T L <tapi...@gmail.com> wrote: >> >> > With the enough initial size, the underlying hashtable of the new map >> > will never need to be realloced in the whole copy process. >> >> For example >> >> dst := make(map[T]U, len(src)) > > > Will setting the second parameter as len(src) make sure the length of the > underlying hashtable is large enough?
Yes. > It looks the official docs doesn't confirm this. The docs say "map of type T with initial space for n elements" (https://golang.org/ref/spec#Making_slices_maps_and_channels). What else would you want them to say? Ian -- 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.