Skip to content

Commit

Permalink
chore: add new benchmark tests (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed Nov 21, 2023
1 parent fb82167 commit 1dbe462
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ants_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,27 @@ func BenchmarkAntsMultiPoolThroughput(b *testing.B) {
}
}
}

func BenchmarkParallelAntsPoolThroughput(b *testing.B) {
p, _ := NewPool(PoolCap, WithExpiryDuration(DefaultExpiredTime))
defer p.Release()

b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_ = p.Submit(demoFunc)
}
})
}

func BenchmarkParallelAntsMultiPoolThroughput(b *testing.B) {
p, _ := NewMultiPool(10, PoolCap/10, RoundRobin, WithExpiryDuration(DefaultExpiredTime))
defer p.ReleaseTimeout(DefaultExpiredTime) //nolint:errcheck

b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_ = p.Submit(demoFunc)
}
})
}

0 comments on commit 1dbe462

Please sign in to comment.