perf(pool): split bytes pool into tiered sized and unsized pools

- Remove BytesPoolWithMemory; split into UnsizedBytesPool and 11-tier SizedBytesPool
- Track buffer capacities with xsync Map to prevent capacity leaks
- Improve buffer reuse: split large buffers and put remainders back in pool
- Optimize small buffers to use unsized pool
- Expand test coverage and benchmarks for various allocation sizes
This commit is contained in:
yusing
2025-10-18 17:38:01 +08:00
parent 5a91db8d10
commit f8716d990e
9 changed files with 60 additions and 76 deletions

View File

@@ -49,7 +49,7 @@ const (
udpReadTimeout = 30 * time.Second
)
var bufPool = synk.GetBytesPool()
var bufPool = synk.GetSizedBytesPool()
func NewUDPUDPStream(listenAddr, dstAddr string) (nettypes.Stream, error) {
dst, err := net.ResolveUDPAddr("udp", dstAddr)