package starmap import ( "fmt" "sync/atomic" "testing" "time" ) func Test_Circle_Speed(t *testing.T) { buf := StarStack{} count := uint64(0) for i := 1; i <= 10; i++ { go func() { for { buf.Push('a') } }() } for i := 1; i <= 10; i++ { go func() { for { _, err := buf.Pop() if err == nil { atomic.AddUint64(&count, 1) } } }() } time.Sleep(time.Second * 10) fmt.Println(count) }