On Mon, Feb 13, 2017 at 12:31 PM, Alex Flint <alex.fl...@gmail.com> wrote:
>
> As of go1.8, do conversions between strings and byte slices always generate
> a copy?

Usually but not absolutely always.

The gc compiler has an optimization for map lookups.  For a
map[string]T, when s is a []byte, m[string(s)] will not make a copy.

I'm not aware of any other similar slice <-> string optimization in
the gc compiler.  There could be some that I don't know about.

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.

Reply via email to