mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
update
This commit is contained in:
@ -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) {
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user