[go-nuts] Re: Why does one string concatenation escape, but the other not?

2021-06-24 Thread tapi...@gmail.com
Filled an issue: https://github.com/golang/go/issues/46908 On Thursday, June 24, 2021 at 10:50:31 PM UTC-4 tapi...@gmail.com wrote: > Now, I think the escape analysis message should be "a + a does not > escapes", > which accurate meaning is "the header part of a + a does not escape". > It is

[go-nuts] Re: Why does one string concatenation escape, but the other not?

2021-06-24 Thread tapi...@gmail.com
Now, I think the escape analysis message should be "a + a does not escapes", which accurate meaning is "the header part of a + a does not escape". It is impossible for the compiler to determine whether or notthe underlying part of "a + a" will escape to heap. On Wednesday, June 23, 2021 at

[go-nuts] Re: Why does one string concatenation escape, but the other not?

2021-06-24 Thread tapi...@gmail.com
On Wednesday, June 23, 2021 at 12:00:43 PM UTC-4 jake...@gmail.com wrote: > It does not answer your question, but possibly provides more clues: > https://play.golang.org/p/s9Xnpcx8Mys > > package main > > func main() { > var a = "b" > x := a + a // does not escape > x = a + a //

[go-nuts] Re: Why does one string concatenation escape, but the other not?

2021-06-23 Thread jake...@gmail.com
It does not answer your question, but possibly provides more clues: https://play.golang.org/p/s9Xnpcx8Mys package main func main() { var a = "b" x := a + a // does not escape x = a + a // does not escape for i := 0; i < 1; i++ { x = a + a // a + a escapes to heap

[go-nuts] Re: Why does one string concatenation escape, but the other not?

2021-06-22 Thread tapi...@gmail.com
Is this to avoid stack growing to fast if there are some stack allocations intervening with each other? On Wednesday, June 23, 2021 at 12:39:17 AM UTC-4 tapi...@gmail.com wrote: > > package main > > import "testing" > > var s33 = []byte{32: 'b'} > > var a = string(s33) > > func main() { > x