forked from mirror/ants
defer release pool
This commit is contained in:
parent
cca93c8dfc
commit
8ad523ca08
|
@ -83,7 +83,7 @@ func BenchmarkAntsPoolWithFunc(b *testing.B) {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
p.Release()
|
defer p.Release()
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
for j := 0; j < RunTimes; j++ {
|
for j := 0; j < RunTimes; j++ {
|
||||||
|
@ -105,7 +105,7 @@ func BenchmarkGoroutine(b *testing.B) {
|
||||||
|
|
||||||
func BenchmarkAntsPool(b *testing.B) {
|
func BenchmarkAntsPool(b *testing.B) {
|
||||||
p, _ := ants.NewPoolWithFunc(50000, demoPoolFunc)
|
p, _ := ants.NewPoolWithFunc(50000, demoPoolFunc)
|
||||||
p.Release()
|
defer p.Release()
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
|
Loading…
Reference in New Issue