From 0964106bb31fd6e634ab4c9826ca25480bb2d362 Mon Sep 17 00:00:00 2001 From: gobwas Date: Wed, 24 Feb 2016 19:44:33 +0300 Subject: [PATCH] try sync pool --- match/segments.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/match/segments.go b/match/segments.go index 1961caa..7d12850 100644 --- a/match/segments.go +++ b/match/segments.go @@ -59,7 +59,10 @@ func init() { // segmentsPools[i-1] = &sync.Pool{New: func() interface{} { // return make([]int, 0, i) // }} - segmentsPools[i-1] = newChanPool(func() []int { + // segmentsPools[i-1] = newChanPool(func() []int { + // return make([]int, 0, i) + // }) + segmentsPools[i-1] = newSyncPool(func() []int { return make([]int, 0, i) }) }(i) @@ -133,7 +136,7 @@ type chanPool struct { func newChanPool(m maker) *chanPool { return &chanPool{ - pool: make(chan []int, 32), + pool: make(chan []int, 16), new: m, } }