mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
close the pool after testing
This commit is contained in:
parent
71521b2044
commit
926f57c696
@ -77,6 +77,7 @@ func BenchmarkGoroutineWithFunc(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkAntsPoolWithFunc(b *testing.B) {
|
||||
defer ants.Release()
|
||||
var wg sync.WaitGroup
|
||||
p, _ := ants.NewPoolWithFunc(50000, func(i interface{}) error {
|
||||
demoPoolFunc(i)
|
||||
@ -103,6 +104,8 @@ func BenchmarkGoroutine(b *testing.B) {
|
||||
|
||||
func BenchmarkAntsPool(b *testing.B) {
|
||||
p, _ := ants.NewPoolWithFunc(50000, demoPoolFunc)
|
||||
p.Release()
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for j := 0; j < RunTimes; j++ {
|
||||
|
||||
@ -54,6 +54,7 @@ func TestDefaultPool(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNoPool(t *testing.T) {
|
||||
defer ants.Release()
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < n; i++ {
|
||||
wg.Add(1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user