This came up about 5 or so years ago.

Brad proposed it, it was deliberated for a while, and Russ articulated why 
it was no doable at the time. There may be a chance to resurrect it, but it 
will be good to see what was written before.

See

Prior discussion: 
https://groups.google.com/forum/?fromgroups=#!topic/golang-dev/Y7j4B2r_eDw
Proposal from Brad 
Fitzpatrick: 
https://docs.google.com/document/d/1UKu_do3FRvfeN5Bb1RxLohV-zBOJWTzX0E8ZU1bkqX0
Evaluation and response from 
Russ: 
https://docs.google.com/document/d/1-NzIYu0qnnsshMBpMPmuO21qd8unlimHgKjRD9qwp2A

Having said that, Russ put this on his list of items to think through for 
2017 (along with other items which are making it to Go 2 now). See 
https://research.swtch.com/go2017 . 

It may be worth it to see what his current thinking on that is.

+rsc @rsc 

On Thursday, July 4, 2019 at 10:27:58 PM UTC-4, Ally Dale wrote:
>
> []byte is mutable in Go, but string is readonly, so []byte(string) in Go 
> is actually allocate&memcopy, and this operation is costly.
> Sometimes, we need a readonly []byte parameter but we have string only, 
> and we have no choice but allocate&memcopy to make a new []byte variable 
> from string.
> Eg: net.Send([]byte("ping")) is costly, but net.Send(readonly 
> []byte("ping")) can be cheaply.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/72e8c24f-5cf6-4eaf-9b94-3afd066eb9b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to