Update READMEs

This commit is contained in:
Andy Pan 2019-10-09 19:42:32 +08:00
parent 66350c88db
commit 0efbda3f68
2 changed files with 10 additions and 10 deletions

View File

@ -20,12 +20,12 @@ Library `ants` implements a goroutine pool with fixed capacity, managing and rec
## Features: ## Features:
- Automatically managing and recycling a massive number of goroutines. - Managing and recycling a massive number of goroutines automatically
- Periodically purging overdue goroutines. - Purging overdue goroutines periodically
- Friendly interfaces: submitting tasks, getting the number of running goroutines, tuning capacity of pool dynamically, closing pool. - Friendly interfaces: submitting tasks, getting the number of running goroutines, tuning capacity of pool dynamically, closing pool
- Handle panic gracefully to prevent programs from crash. - Handle panic gracefully to prevent programs from crash
- Efficient in memory usage and it even achieves higher performance than unlimited goroutines in golang. - Efficient in memory usage and it even achieves higher performance than unlimited goroutines in Golang
- Nonblocking mechanism. - Nonblocking mechanism
## Tested in the following Golang versions: ## Tested in the following Golang versions:
@ -295,7 +295,7 @@ All tasks submitted to `ants` pool will not be guaranteed to be addressed in ord
## Benchmarks ## Benchmarks
<div align="center"><img src="https://user-images.githubusercontent.com/7496278/51515466-c7ce9e00-1e4e-11e9-89c4-bd3785b3c667.png"/></div> <div align="center"><img src="https://user-images.githubusercontent.com/7496278/51515466-c7ce9e00-1e4e-11e9-89c4-bd3785b3c667.png"/></div>
In this benchmark-picture, the first and second benchmarks performed test cases with 1M tasks and the rest of 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. In this benchmark result, the first and second benchmarks performed test cases with 1M tasks and the rest of 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.
- BenchmarkGoroutine-4 represents the benchmarks with unlimited goroutines in golang. - BenchmarkGoroutine-4 represents the benchmarks with unlimited goroutines in golang.
@ -305,7 +305,7 @@ All tasks submitted to `ants` pool will not be guaranteed to be addressed in ord
![](https://user-images.githubusercontent.com/7496278/51515499-f187c500-1e4e-11e9-80e5-3df8f94fa70f.png) ![](https://user-images.githubusercontent.com/7496278/51515499-f187c500-1e4e-11e9-80e5-3df8f94fa70f.png)
In above benchmark picture, the first and second benchmarks performed test cases with 1M tasks and the rest of 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. In above benchmark result, the first and second benchmarks performed test cases with 1M tasks and the rest of 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.
**As you can see, `ants` performs 2 times faster than goroutines without pool (10M tasks) and it only consumes half the memory comparing with goroutines without pool. (both in 1M and 10M tasks)** **As you can see, `ants` performs 2 times faster than goroutines without pool (10M tasks) and it only consumes half the memory comparing with goroutines without pool. (both in 1M and 10M tasks)**

View File

@ -20,8 +20,8 @@ A goroutine pool for Go
## 功能: ## 功能:
- 实现了自动调度并发的 goroutine复用 goroutine - 自动调度海量的 goroutines复用 goroutines
- 定时清理过期的 goroutine进一步节省资源 - 定时清理过期的 goroutines,进一步节省资源
- 提供了友好的接口:任务提交、获取运行中的协程数量、动态调整协程池大小 - 提供了友好的接口:任务提交、获取运行中的协程数量、动态调整协程池大小
- 优雅处理 panic防止程序崩溃 - 优雅处理 panic防止程序崩溃
- 资源复用,极大节省内存使用量;在大规模批量并发任务场景下比原生 goroutine 并发具有更高的性能 - 资源复用,极大节省内存使用量;在大规模批量并发任务场景下比原生 goroutine 并发具有更高的性能