1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00
This commit is contained in:
2022-06-10 17:04:34 +08:00
parent 853b19fb02
commit 9bb232be93
22 changed files with 641 additions and 147 deletions

View File

@ -33,6 +33,21 @@ func TestPoolSize(t *testing.T) {
}
}
func TestBytesPool(t *testing.T) {
var n = 0
p := pool.NewPoolWithNew(100, func() []byte {
t.Log("new")
n++
return make([]byte, 100, 100)
})
for i := 0; i < 1000; i++ {
go p.Put(p.Get())
}
t.Log("new count:", n)
}
func TestPut(t *testing.T) {
p := pool.NewPool[PoolObject](10)
for i := 0; i < 15; i++ {
@ -64,3 +79,7 @@ func BenchmarkPoolNew(b *testing.B) {
}
})
}
func TestNewFunc(t *testing.T) {
}