[go-nuts] defer func running timing

2022-06-25 Thread Lee Chou
Hello, https://go.dev/play/p/J1tVplkIrjt why o1.Ref print `2` but p1.Ref print `1` ? why o1.Ref print `2` but o2.NonRef print `3` ? it's so confused. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rec

Re: [go-nuts] defer func running timing

2022-06-26 Thread Lee Chou
evaluated immediately, but the execution only > happens later > > - sean > > On Sat, Jun 25, 2022, 21:40 Lee Chou wrote: > >> Hello, >> >> https://go.dev/play/p/J1tVplkIrjt >> >> why o1.Ref print `2` but p1.Ref print `1` ? >> why o1.Ref pri

[go-nuts] Some confusion about escape analysis

2022-08-23 Thread Lee Chou
I was try using net.Buffers for writev. But I meet a unexptected allocs in benchmark. https://go.dev/play/p/SHpxSYbP1I5 when I run the benchmark: goos: linux goarch: amd64 pkg: writev BenchmarkWrite_Writev/escape-4 272901 4198 ns/op 24 B/op 1 allocs/

[go-nuts] Re: Some confusion about escape analysis

2022-08-26 Thread Lee Chou
Thanks for taking the time for the clue. It seems that this is an open issue. Actually, It work for this case. aovid the alloc will have more benefit for gc. 在2022年8月26日星期五 UTC+8 02:49:08 写道: > Actually, looking more closely at your benchmark numbers, the trick does > not work in your case.