Re: [go-nuts] A question about performance when traverse the array with row-wise and column-wise

2019-09-29 Thread zct
I think in my test code, what affect the performance maybe the cpu branches misses? The row num is bigger than the column num, so in column-wise traverse, the inner loop is easier to predict. perf result: row-wise 0.034014712741,811 branch-misses # 1.05% o

[go-nuts] A question about performance when traverse the array with row-wise and column-wise

2019-09-29 Thread zct
The test code is below: package main import ( "testing" ) const rowSize = 100 const colSize = 100 var array [rowSize][colSize]int func BenchmarkRow(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { sum := 0 for r := 0; r < rowSize; r++ { for c := 0; c < colSize; c++ { sum += array[r

Re: [go-nuts] A problem about runtime.SetFinalizer

2019-08-21 Thread zct
I got it.Thank you for your help 在 2019年8月21日星期三 UTC+8下午11:00:26,Ian Lance Taylor写道: > > On Wed, Aug 21, 2019 at 5:55 AM zct > wrote: > > > > I recently had a goroutine leak problem, the code i reduced is like > this: https://play.golang.org/p/YW4hWoZZ7CD. >

[go-nuts] A problem about runtime.SetFinalizer

2019-08-21 Thread zct
I recently had a goroutine leak problem, the code i reduced is like this: https://play.golang.org/p/YW4hWoZZ7CD. The program is long-running and the finalizer is not called The RoomObj is deleted from map, why was it not released? Is it refereed by the asyncChan object? I don't understand he