On Wednesday, August 3, 2016 at 11:59:27 PM UTC+8, Hotei wrote: > > Have you tried examining the assembler output? go build -gcflags="-S" > program.go if I recall correctly. >
yes, the output is different, looks like optimization is not made here, but I can't make sure. > > > On Wednesday, August 3, 2016 at 11:27:36 AM UTC-4, T L wrote: >> >> >> I know a string value can be used as []byte if the first parameter if the >> builtin copy/append function is a []byte value: >> >>> var bs []byte = make([]byte, 10) >>> copy(bs, "abcde") >> >> >> but if do explicit conversion anyway on the second string value >> >>> var bs []byte = make([]byte, 10) >>> copy(bs, []byte("abcde")) >>> >> will compiler do optimization here to avoid copying the underline byte >> array of the string? >> >> -- 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.