🚀 Features
- feat: add MultiPool and MultiPoolWithFunc (#305)
🛩 Enhancements
- opt: fall back to LeastTasks when RoundRobin can't find a worker (#306)
- feat: add MultiPool and MultiPoolWithFunc (#305)
- refactor: enforce a few minor optimizations in code (#302)
- refactor: refine the code in
retrieveWorker
to make it more readable (#295)
🐛 Bugfixes
- bug: return the error from Pool.Submit/PoolWithFunc.Invoke accordingly (#297)
- bug: fix the potential goroutine leak after calling
Release()
(#287)
📚 Documentation
- chore: eliminate some useless content (#303)
- chore: update READMEs 16771ce
- chore: add a new use case (#290)
🗃 Misc
- chore: eliminate some useless content (#303)
- chore: enable more title matchers for auto-labelers of bug and new feature (#300)
- chore: enable auto-labeler for PRs of updating semantic version (#298)
- chore: clean up some comments and CI yaml (#296)
- chore: bump up modules (#292)
Full Changelog: v2.8.0...v2.9.0
Performance improvement
In version v2.9.0, ants
introduces two new pool types: MultiPool
and MultiPoolWithFunc
from which you will benefit the
performance improvement on the basis of the fine-grained locking that reduces the lock contention.
These two pools are a good fit for the scenario where you have a large number of tasks to submit, and you don't want the single pool to be the bottleneck.
Benchmark testing
goos: darwin
goarch: arm64
pkg: github.com/panjf2000/ants/v2
BenchmarkAntsPool-10 2 777222500 ns/op 25458216 B/op 1115895 allocs/op
BenchmarkAntsMultiPool-10 2 667141666 ns/op 23590496 B/op 1105121 allocs/op
BenchmarkAntsPoolThroughput-10 2 747288979 ns/op 9266236 B/op 117693 allocs/op
BenchmarkAntsMultiPoolThroughput-10 2 579771771 ns/op 4550356 B/op 66303 allocs/op
BenchmarkParallelAntsPoolThroughput-10 1405256 801.3 ns/op 9 B/op 0 allocs/op
BenchmarkParallelAntsMultiPoolThroughput-10 2264618 473.6 ns/op 9 B/op 0 allocs/op
Thanks to all these contributors: @ELchem, @POABOB and @panjf2000 for making this release possible.