I surely will use the first version in practice.
I just want to make things clear, :)
On Thursday, August 4, 2016 at 3:23:11 AM UTC+8, Hotei wrote:
>
> If you create the source as a byte array by converting it ([]byte("abcde")
> then the compiler can NOT optimize it away. However - I don't
If you create the source as a byte array by converting it ([]byte("abcde")
then the compiler can NOT optimize it away. However - I don't think it
will *use* the capacity information in the source since it's not relevant
and it's going to copy the data bytes and length in any case.
If you're
On Thursday, August 4, 2016 at 12:40:41 AM UTC+8, Hotei wrote:
>
> Looking at the asm it appears that there is a conversion func called in
> the second version - right before the copy with memmove.
>
> Based on this I'd say what happens AFTER the conversion is the same in
> both version since
Looking at the asm it appears that there is a conversion func called in the
second version - right before the copy with memmove.
Based on this I'd say what happens AFTER the conversion is the same in both
version since the destination is the same and the content is the same. The
only
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
Have you tried examining the assembler output? go build -gcflags="-S"
program.go if I recall correctly.
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