try sync pool

This commit is contained in:
gobwas 2016-02-24 19:44:33 +03:00
parent 6dc0cef691
commit 0964106bb3
1 changed files with 5 additions and 2 deletions

View File

@ -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,
}
}