Ants Versions Save

🐜🐜🐜 ants is a high-performance and low-cost goroutine pool in Go./ ants ζ˜―δΈ€δΈͺι«˜ζ€§θƒ½δΈ”δ½ŽζŸθ€—ηš„ goroutine 池。

v2.9.0

5 months ago

πŸš€ 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 16771ceb8fe801ee3679d590b84b762556264b71
  • 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: https://github.com/panjf2000/ants/compare/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.

v2.8.0

10 months ago

πŸš€ Features

  • feat: add a new API ReleaseTimeout for the default pool (#285)

πŸ›© Enhancements

  • feat: add a new API ReleaseTimeout for the default pool (#285)
  • bug: avoid overflow when computing mid in the binarySearch of the workerStack (#278)
  • opt: refactor the worker queue for reusability and readability of code (#270)
  • opt: awake blocking goroutines more precisely in purgeStaleWorkers b32591f8bda98a7774ba4ec312cfc440aabb3be4
  • opt: use runtime/debug.Stack() to print stack trace of panic 7a56a5c082182514385a91145b3f7dac01b6e0a2
  • opt: refactor the worker queue for reusability and readability of code 0313effc53ee00ee453f526367737214cc1c339b
  • opt: refine some code b6eaea118bdeadff62fc6e0d519d4287cc92d62c

πŸ› Bugfixes

  • bug: avoid overflow when computing mid in the binarySearch of the workerStack (#278)
  • bug: fix the missing log.Lmsgprefix in go1.13 (#275)
  • fix: exit ticktock goroutine when pool is closed (#264)

πŸ“š Documentation

  • doc: update use cases 33c77540bd1c161998dabe8c3736486b46c9ca5f
  • chore: update READMEs b9ac4d4730a1c3f216aad408eaabd5b9c24e50ba

🧳 Misc

  • chore: reorganize the structure of internal packages 711cad96247f796614bca29f0bcfb3f49b6d95bd
  • chore: reformat the default log string 3110e41921923cd446e6d8add193a932d37ef167

Full Changelog: https://github.com/panjf2000/ants/compare/v2.7.0...v2.8.0

Thanks to all these contributors: @ELchem, @GlebRadchenko, @gocurr, @panjf2000 and @piaodazhu for making this release possible.

v2.7.0

1 year ago

Changelogs

πŸ›© Enhancements

  • opt: cache current time for workders and update it periodically (#261)

Performance improvement:

goos: darwin
goarch: arm64
pkg: github.com/panjf2000/ants/v2

name         old time/op    new time/op    delta
AntsPool-10     771ms Β± 9%     669ms Β± 6%  -13.29%  (p=0.000 n=10+10)

name         old alloc/op   new alloc/op   delta
AntsPool-10    23.0MB Β± 5%    23.0MB Β± 4%    ~    (p=0.968 n=10+9)

name         old allocs/op  new allocs/op  delta
AntsPool-10     1.10M Β± 1%     1.10M Β± 1%    ~     (p=0.182 n=10+9)

Full Changelog: https://github.com/panjf2000/ants/compare/v2.6.0...v2.7.0

Thanks to all these contributors: @panjf2000 for making this release possible.

v2.6.0

1 year ago

Features

Add option to turn off automatically purge (#253) b604f7dc644656e4870d1ddbcbe7318155a9bd21

v2.5.0

2 years ago

Features

  • Implement pool.ReleaseTimeout() 96d074234a612a15078f25cf2f156f833ff3182f 15f3cdfb7bd40e21ae0eb4e1ba9901d8cfa1cb2a
  • Implement pool.Waiting() 9310acdff2ced5a835ac3ea94206c43b6708c3d3

Bugfixes

  • Fix some trivial bugs

Misc

  • Add one more use case (Baidu App) 9d85d57cc4402959180e41c52fcb3baa8bc71ac8

v2.4.0

4 years ago

Features

  • Support customized logger e507ae340f27deb71a28000a709bd0f134bf23ad
  • Support unlimited pool (#90)

Bugfixes

  • Fix a bug that doesn't release lock (#79)

Misc

  • Add go1.14 support on CI
  • Leverage reviewdog as automated code review tool 77a3da4040e71dcd9585441194f4dd6ee382ac25
  • Fix code issues d55cc24a22196c0875d1b522a3e12bfbd3d2a307
  • Fix indent on README (#89)

v2.3.0

4 years ago

Features

  • Add a feature of rebooting a released pool d32d668565c40283b3d0066cc6d9406def693edb
  • Testing ants on multiple operating systems 73c26bc792cf31dec6e06e2787a707c43c741057

Enhancements

  • Optimize the logic when putting worker back to sync.Pool 8cbfb5dd672c68c9cf852ee8350027d6f48017fe
  • Optimize loop queue of workers 7aaa4349f58c6990c283dbaaca37622bf9051871
  • Leverage tool testify to refine unit-test code ea787e5c0b376790ccab178676a9eebcede0c265
  • sync.Pool opt 3bfc4f2ebd49ec5c862a86adbb83c99949aa7ae2

Docs

  • Add more user cases of ants 6b4a00c5cc7cbb917e0876af9d60a745dd5886c7
  • Document Reboot() 67766a56615dd4369d6b4f0738b228c806290e91

Misc

  • Add JetBrains logo for thanks of its support 88fe6df3ab464b44cfaa91f4d6889a2c5fd97245
  • Fix a failed test on Windows temporarily 1b1fee36aa89ec1b44f249bb9714ad72898b7367

v2.2.0

4 years ago

Features

  • Support loop queue as workers queue #53

Enhancements

  • Refine the logic of sync.Pool b1cf2ff44563cf7d568f7302e08e8581d20e77be
  • Refactoring to the interface and implementations of worker-array 566511ec5f3ccafb29d16853fc76ab5a4d370e3f
  • Make optimization to Pool and PoolWithFunc struct 5ecbdf4bf2bdbf4acd099b89acdc3ee651317fdf

Docs

  • Update README with awesome 2b9f35b18f3ea03675888c4dea8ed144aa584e09
  • Add flowcharts of ants into READMEs 49150bfa5efb589d06c72bd706300e10b2f476f3
  • Add doc.go 023672e8775d1e5e04c1c9e119a3da9de32aef28

Misc

  • Refactor code b0ec5102cc8bba67e94d12895b98bcf343212e4a
  • Fix a issue in testing nonblocking pool 0a946593e2443357c0cf54c1b7b25a953dda427c
  • Increase code coverage 7724fc2c7b91ccdde52a495a905259cfdb1d641c

v2.1.0

4 years ago

Enhancements

  • Replace mutex with spin-lock e73db1d7d226408976ed89d514588a5fee7e87fa

v2.0.0

4 years ago

Features

  • Optimize memory allocation and add the log of panic stack (#40)
  • Support nonblocking submit and max blocking limit setting (#41)
  • Add functional options pattern for ants 201ac20358578a34c3131049e3825c14bfb061a2

Bugfixes

  • Fix a bug that blocks getting worker from pool 51c0008356f635f6e9658d5d0bc76b6de7b23b96
  • Fix a bug where invokers get stuck in waiting idle workers af70ed06608fd1885efa56ba406b06476bf7060f 08d01b6b480f74dfa5586a8901878cd466b66de8
  • Fix a bug that worker didn't minus the amount of running workers when it exits (#51)

Enhancements

  • Improve the process of cleaning up idle workers (#39)
  • Refactor the blocking logic in retrieveWorker function 61660e2109c7181a8ab5110f3520ac78f0e9ff95
  • Improve the the logic of tuning the pool size and support go modules cbf8ddf048f74fcf103f315d591dc45550efa8d4

Docs

  • Update README afb53226745477ccac7145addbc177b6cd727f50
  • Improve grammar in README and add go1.13 to CI 280ac345a860e794df1268e15112db9a863900ca
  • Update README 09973e8b1b6ad0adc715cd302da41c39f0265752

Misc

  • Support go mod 26cbd886a9d7e114cda5e5c18728ed531ba42999
  • Rename the function with the more applicable name 71faec8c1a2b5b4114dbca77d1ed43c8d8f55960
  • Fix some minor mistakes in test cases 94763266ad20fb1eadb57e796bfa7d27afe7de48
  • Create CODE_OF_CONDUCT.md (#48)
  • Create pull_request_template.md 40defbb369c28b077d32890edbe64ab9200b4601