On Tuesday, January 31, 2017 at 1:15:40 PM UTC+8, Keiji Yoshida wrote: > > Hi, > > "Declaring Empty Slices" of CodeReviewComments ( > https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices > ) says as below: > > ``` > When declaring a slice, use > > var t []string > > rather than > > t := []string{} > > The former avoids allocating memory if the slice is never appended to. > ``` >
One of the two "t"s is nil (the first one), the other one is not. > > I executed a benchmark test against above code but I could not see any > difference between them as for the results. > > My benchmark test code and its results can be seen here: > https://github.com/keijiyoshida/go-code-snippets/blob/master/empty-slice-declaration/main_test.go > > Is there something wrong in my benchmark test code or procedure? > > Thanks, > Keiji Yoshida > -- 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.