mirror of https://github.com/ehang-io/nps
24 lines
402 B
Go
24 lines
402 B
Go
![]() |
package utils
|
||
|
|
||
|
import "sync"
|
||
|
|
||
|
const poolSize = 64 * 1024
|
||
|
const poolSizeSmall = 10
|
||
|
const poolSizeCopy = 32 * 1024
|
||
|
|
||
|
var bufPool = sync.Pool{
|
||
|
New: func() interface{} {
|
||
|
return make([]byte, poolSize)
|
||
|
},
|
||
|
}
|
||
|
var bufPoolSmall = sync.Pool{
|
||
|
New: func() interface{} {
|
||
|
return make([]byte, poolSizeSmall)
|
||
|
},
|
||
|
}
|
||
|
var bufPoolCopy = sync.Pool{
|
||
|
New: func() interface{} {
|
||
|
return make([]byte, poolSizeCopy)
|
||
|
},
|
||
|
}
|