Skip to content

Commit 5dfe043

Browse files
authored
Merge pull request #331 from panjf2000/dev
minor: v2.10.0
2 parents fc3f793 + b40e489 commit 5dfe043

File tree

11 files changed

+511
-219
lines changed

11 files changed

+511
-219
lines changed

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
3333

3434
# Drafts your next Release notes as Pull Requests are merged into "master"
35-
- uses: release-drafter/release-drafter@v5
35+
- uses: release-drafter/release-drafter@v6
3636
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
3737
# with:
3838
# config-name: my-config.yml

.github/workflows/test.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,41 @@ jobs:
3636
name: Run golangci-lint
3737
runs-on: ${{ matrix.os }}
3838
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
3942
- name: Setup Go
4043
uses: actions/setup-go@v5
4144
with:
4245
go-version: '^1.16'
43-
44-
- name: Checkout repository
45-
uses: actions/checkout@v4
46+
cache: false
4647

4748
- name: Setup and run golangci-lint
48-
uses: golangci/golangci-lint-action@v3
49+
uses: golangci/golangci-lint-action@v4
4950
with:
50-
version: v1.55.2
51+
version: v1.57.2
5152
args: --timeout 5m -v -E gofumpt -E gocritic -E misspell -E revive -E godot
5253
test:
5354
needs: lint
5455
strategy:
5556
fail-fast: false
5657
matrix:
57-
go: [1.13, 1.21]
58+
go: [1.13, 1.22]
5859
os: [ubuntu-latest, macos-latest, windows-latest]
60+
include:
61+
# TODO(panjf2000): There is an uncanny issue arising when downloading
62+
# go modules on macOS 13 for Go1.13. So we use macOS 12 for now,
63+
# but try to figure it out and use macOS once it's resolved.
64+
# https://github.com/panjf2000/ants/actions/runs/9546726268/job/26310385582
65+
- go: 1.13
66+
os: macos-12
67+
exclude:
68+
# Starting macOS 14 GitHub Actions runners are arm-based,
69+
# but Go didn't support arm64 until 1.16. Thus, we must
70+
# replace the macOS 14 runner with macOS 12 runner for Go 1.13.
71+
# Ref: https://github.com/actions/runner-images/issues/9741
72+
- go: 1.13
73+
os: macos-latest
5974
name: Go ${{ matrix.go }} @ ${{ matrix.os }}
6075
runs-on: ${{ matrix.os}}
6176
steps:
@@ -82,16 +97,6 @@ jobs:
8297
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
8398
echo "GO_CACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
8499
85-
- name: Cache go modules
86-
uses: actions/cache@v4
87-
with:
88-
path: |
89-
${{ steps.go-env.outputs.GO_CACHE }}
90-
~/go/pkg/mod
91-
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
92-
restore-keys: |
93-
${{ runner.os }}-${{ matrix.go }}-go-ci
94-
95100
- name: Run unit tests and integrated tests
96101
run: go test -v -race -coverprofile="codecov.report" -covermode=atomic
97102

README.md

Lines changed: 141 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -293,53 +293,12 @@ pool.Reboot()
293293

294294
All tasks submitted to `ants` pool will not be guaranteed to be addressed in order, because those tasks scatter among a series of concurrent workers, thus those tasks would be executed concurrently.
295295

296-
## 🧲 Benchmarks
297-
298-
<div align="center"><img src="https://user-images.githubusercontent.com/7496278/51515466-c7ce9e00-1e4e-11e9-89c4-bd3785b3c667.png"/></div>
299-
In this benchmark result, the first and second benchmarks performed test cases with 1M tasks, and the rest of the benchmarks performed test cases with 10M tasks, both in unlimited goroutines and `ants` pool, and the capacity of this `ants` goroutine pool was limited to 50K.
300-
301-
- BenchmarkGoroutine-4 represents the benchmarks with unlimited goroutines in Golang.
302-
303-
- BenchmarkPoolGroutine-4 represents the benchmarks with an `ants` pool.
304-
305-
### Benchmarks with Pool
306-
307-
![](https://user-images.githubusercontent.com/7496278/51515499-f187c500-1e4e-11e9-80e5-3df8f94fa70f.png)
308-
309-
In the above benchmark result, the first and second benchmarks performed test cases with 1M tasks, and the rest of the benchmarks performed test cases with 10M tasks, both in unlimited goroutines and `ants` pool and the capacity of this `ants` goroutine-pool was limited to 50K.
310-
311-
**As you can see, `ants` performs 2 times faster than goroutines without a pool (10M tasks) and it only consumes half the memory compared with goroutines without a pool. (both in 1M and 10M tasks)**
312-
313-
### Benchmarks with PoolWithFunc
314-
315-
![](https://user-images.githubusercontent.com/7496278/51515565-1e3bdc80-1e4f-11e9-8a08-452ab91d117e.png)
316-
317-
### Throughput (it is suitable for scenarios where tasks are submitted asynchronously without waiting for the final results)
318-
319-
#### 100K tasks
320-
321-
![](https://user-images.githubusercontent.com/7496278/51515590-36abf700-1e4f-11e9-91e4-7bd3dcb5f4a5.png)
322-
323-
#### 1M tasks
324-
325-
![](https://user-images.githubusercontent.com/7496278/51515596-44617c80-1e4f-11e9-89e3-01e19d2979a1.png)
326-
327-
#### 10M tasks
328-
329-
![](https://user-images.githubusercontent.com/7496278/52987732-537c2000-3437-11e9-86a6-177f00d7a1d6.png)
330-
331-
## 📊 Performance Summary
332-
333-
![](https://user-images.githubusercontent.com/7496278/63449727-3ae6d400-c473-11e9-81e3-8b3280d8288a.gif)
334-
335-
**In conclusion, `ants` performs 2~6 times faster than goroutines without a pool and the memory consumption is reduced by 10 to 20 times.**
336-
337296
## 👏 Contributors
338297

339298
Please read our [Contributing Guidelines](CONTRIBUTING.md) before opening a PR and thank you to all the developers who already made contributions to `ants`!
340299

341300
<a href="https://github.com/panjf2000/ants/graphs/contributors">
342-
<img src="https://contrib.rocks/image?repo=panjf2000/ants" />
301+
<img src="https://contrib.rocks/image?repo=panjf2000/ants" />
343302
</a>
344303

345304
## 📄 License
@@ -359,7 +318,105 @@ The source code in `ants` is available under the [MIT License](/LICENSE).
359318

360319
The following companies/organizations use `ants` in production.
361320

362-
<a href="https://www.tencent.com"><img src="https://res.strikefreedom.top/static_res/logos/tencent_logo.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.bytedance.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/ByteDance_Logo.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://tieba.baidu.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/baidu-tieba-logo.png" width="300" align="middle"/></a>&nbsp;&nbsp;<a href="https://weibo.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/weibo-logo.png" width="300" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.tencentmusic.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/tencent-music-logo.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.futuhk.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/futu-logo.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.shopify.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/shopify-logo.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.wechat.com/en/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/wechat-logo.png" width="250" align="middle"/></a><a href="https://www.baidu.com/" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/baidu-mobile.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.360.com" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/360-logo.png" width="250" align="middle"/></a><a href="https://www.huaweicloud.com/intl/en-us/" target="_blank"><img src="https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/%E7%BB%84%E4%BB%B6%E9%AA%8C%E8%AF%81/pep-common-header/logo-en.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.matrixorigin.io" target="_blank"><img src="https://www.matrixorigin.io/_next/static/media/logo-light-en.42553c69.svg" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://adguard-dns.io" target="_blank"><img src="https://cdn.adtidy.org/website/images/AdGuardDNS_black.svg" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://bk.tencent.com" target="_blank"><img src="https://static.apiseven.com/2022/11/14/6371adab14119.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.alibabacloud.com" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/aliyun-intl.png" width="250" align="middle"/></a>&nbsp;&nbsp;<a href="https://www.zuoyebang.com" target="_blank"><img src="https://res.strikefreedom.top/static_res/logos/zuoyebang-logo.jpeg" width="300" align="middle"/></a>
321+
<table>
322+
<tbody>
323+
<tr>
324+
<td align="center" valign="middle">
325+
<a href="https://www.tencent.com">
326+
<img src="https://res.strikefreedom.top/static_res/logos/tencent_logo.png" width="250" />
327+
</a>
328+
</td>
329+
<td align="center" valign="middle">
330+
<a href="https://www.bytedance.com/" target="_blank">
331+
<img src="https://res.strikefreedom.top/static_res/logos/ByteDance_Logo.png" width="250" />
332+
</a>
333+
</td>
334+
<td align="center" valign="middle">
335+
<a href="https://tieba.baidu.com/" target="_blank">
336+
<img src="https://res.strikefreedom.top/static_res/logos/baidu-tieba-logo.png" width="300" />
337+
</a>
338+
</td>
339+
<td align="center" valign="middle">
340+
<a href="https://weibo.com/" target="_blank">
341+
<img src="https://res.strikefreedom.top/static_res/logos/weibo-logo.png" width="300" />
342+
</a>
343+
</td>
344+
</tr>
345+
<tr>
346+
<td align="center" valign="middle">
347+
<a href="https://www.tencentmusic.com/" target="_blank">
348+
<img src="https://res.strikefreedom.top/static_res/logos/tencent-music-logo.png" width="250" />
349+
</a>
350+
</td>
351+
<td align="center" valign="middle">
352+
<a href="https://www.futuhk.com/" target="_blank">
353+
<img src="https://res.strikefreedom.top/static_res/logos/futu-logo.png" width="250" />
354+
</a>
355+
</td>
356+
<td align="center" valign="middle">
357+
<a href="https://www.shopify.com/" target="_blank">
358+
<img src="https://res.strikefreedom.top/static_res/logos/shopify-logo.png" width="250" />
359+
</a>
360+
</td>
361+
<td align="center" valign="middle">
362+
<a href="https://www.wechat.com/en/" target="_blank">
363+
<img src="https://res.strikefreedom.top/static_res/logos/wechat-logo.png" width="250" />
364+
</a>
365+
</td>
366+
</tr>
367+
<tr>
368+
<td align="center" valign="middle">
369+
<a href="https://www.baidu.com/" target="_blank">
370+
<img src="https://res.strikefreedom.top/static_res/logos/baidu-mobile.png" width="250" />
371+
</a>
372+
</td>
373+
<td align="center" valign="middle">
374+
<a href="https://www.360.com" target="_blank">
375+
<img src="https://res.strikefreedom.top/static_res/logos/360-logo.png" width="250" />
376+
</a>
377+
</td>
378+
<td align="center" valign="middle">
379+
<a href="https://www.huaweicloud.com/intl/en-us/" target="_blank">
380+
<img src="https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/%E7%BB%84%E4%BB%B6%E9%AA%8C%E8%AF%81/pep-common-header/logo-en.png" width="250" />
381+
</a>
382+
</td>
383+
<td align="center" valign="middle">
384+
<a href="https://www.matrixorigin.io" target="_blank">
385+
<img src="https://www.matrixorigin.io/_next/static/media/logo-light-en.42553c69.svg" width="250" />
386+
</a>
387+
</td>
388+
</tr>
389+
<tr>
390+
<td align="center" valign="middle">
391+
<a href="https://adguard-dns.io" target="_blank">
392+
<img src="https://cdn.adtidy.org/website/images/AdGuardDNS_black.svg" width="250" />
393+
</a>
394+
</td>
395+
<td align="center" valign="middle">
396+
<a href="https://bk.tencent.com" target="_blank">
397+
<img src="https://static.apiseven.com/2022/11/14/6371adab14119.png" width="250" />
398+
</a>
399+
</td>
400+
<td align="center" valign="middle">
401+
<a href="https://www.alibabacloud.com" target="_blank">
402+
<img src="https://res.strikefreedom.top/static_res/logos/aliyun-intl.png" width="250" />
403+
</a>
404+
</td>
405+
<td align="center" valign="middle">
406+
<a href="https://www.zuoyebang.com" target="_blank">
407+
<img src="https://res.strikefreedom.top/static_res/logos/zuoyebang-logo.jpeg" width="300" />
408+
</a>
409+
</td>
410+
</tr>
411+
<tr>
412+
<td align="center" valign="middle">
413+
<a href="https://www.antgroup.com/en" target="_blank">
414+
<img src="https://gw.alipayobjects.com/mdn/rms_27e257/afts/img/A*PLZaSZnCPAwAAAAAAAAAAAAAARQnAQ" width="250" />
415+
</a>
416+
</td>
417+
</tr>
418+
</tbody>
419+
</table>
363420

364421
### open-source software
365422

@@ -422,7 +479,47 @@ Become a bronze sponsor with a monthly donation of $10 and get your logo on our
422479

423480
## 💵 Patrons
424481

425-
<a target="_blank" href="https://github.com/patrick-othmer"><img src="https://avatars1.githubusercontent.com/u/8964313" width="100" alt="Patrick Othmer" /></a>&nbsp;<a target="_blank" href="https://github.com/panjf2000/ants"><img src="https://avatars2.githubusercontent.com/u/50285334" width="100" alt="Jimmy" /></a>&nbsp;<a target="_blank" href="https://github.com/cafra"><img src="https://avatars0.githubusercontent.com/u/13758306" width="100" alt="ChenZhen" /></a>&nbsp;<a target="_blank" href="https://github.com/yangwenmai"><img src="https://avatars0.githubusercontent.com/u/1710912" width="100" alt="Mai Yang" /></a>&nbsp;<a target="_blank" href="https://github.com/BeijingWks"><img src="https://avatars3.githubusercontent.com/u/33656339" width="100" alt="王开帅" /></a>&nbsp;<a target="_blank" href="https://github.com/refs"><img src="https://avatars3.githubusercontent.com/u/6905948" width="100" alt="Unger Alejandro" /></a>&nbsp;<a target="_blank" href="https://github.com/Wuvist"><img src="https://avatars.githubusercontent.com/u/657796" width="100" alt="Weng Wei" /></a>
482+
<table>
483+
<tbody>
484+
<tr>
485+
<td align="center" valign="middle">
486+
<a target="_blank" href="https://github.com/patrick-othmer">
487+
<img src="https://avatars1.githubusercontent.com/u/8964313" width="100" alt="Patrick Othmer" />
488+
</a>
489+
</td>
490+
<td align="center" valign="middle">
491+
<a target="_blank" href="https://github.com/panjf2000/ants">
492+
<img src="https://avatars2.githubusercontent.com/u/50285334" width="100" alt="Jimmy" />
493+
</a>
494+
</td>
495+
<td align="center" valign="middle">
496+
<a target="_blank" href="https://github.com/cafra">
497+
<img src="https://avatars0.githubusercontent.com/u/13758306" width="100" alt="ChenZhen" />
498+
</a>
499+
</td>
500+
<td align="center" valign="middle">
501+
<a target="_blank" href="https://github.com/yangwenmai">
502+
<img src="https://avatars0.githubusercontent.com/u/1710912" width="100" alt="Mai Yang" />
503+
</a>
504+
</td>
505+
<td align="center" valign="middle">
506+
<a target="_blank" href="https://github.com/BeijingWks">
507+
<img src="https://avatars3.githubusercontent.com/u/33656339" width="100" alt="王开帅" />
508+
</a>
509+
</td>
510+
<td align="center" valign="middle">
511+
<a target="_blank" href="https://github.com/refs">
512+
<img src="https://avatars3.githubusercontent.com/u/6905948" width="100" alt="Unger Alejandro" />
513+
</a>
514+
</td>
515+
<td align="center" valign="middle">
516+
<a target="_blank" href="https://github.com/Wuvist">
517+
<img src="https://avatars.githubusercontent.com/u/657796" width="100" alt="Weng Wei" />
518+
</a>
519+
</td>
520+
</tr>
521+
</tbody>
522+
</table>
426523

427524
## 🔋 Sponsorship
428525

0 commit comments

Comments
 (0)