mirror of https://github.com/panjf2000/ants.git
Add the installation about ants v2
This commit is contained in:
parent
49150bfa5e
commit
5f1a32384f
10
README.md
10
README.md
|
@ -44,10 +44,18 @@ Library `ants` implements a goroutine pool with fixed capacity, managing and rec
|
|||
|
||||
## How to install
|
||||
|
||||
``` sh
|
||||
### For `ants` v1
|
||||
|
||||
``` powershell
|
||||
go get -u github.com/panjf2000/ants
|
||||
```
|
||||
|
||||
### For `ants` v2
|
||||
|
||||
```powershell
|
||||
go get -u github.com/panjf2000/ants/v2
|
||||
```
|
||||
|
||||
## How to use
|
||||
Just take a imagination that your program starts a massive number of goroutines, resulting in a huge consumption of memory. To mitigate that kind of situation, all you need to do is to import `ants` package and submit all your tasks to a default pool with fixed capacity, activated when package `ants` is imported:
|
||||
|
||||
|
|
11
README_ZH.md
11
README_ZH.md
|
@ -42,13 +42,20 @@ A goroutine pool for Go
|
|||
<img width="1028" alt="ants" src="https://user-images.githubusercontent.com/7496278/66307062-f6859980-e935-11e9-9f30-241c348cbc33.png">
|
||||
</p>
|
||||
|
||||
|
||||
## 安装
|
||||
|
||||
``` sh
|
||||
### 使用 `ants` v1 版本:
|
||||
|
||||
``` powershell
|
||||
go get -u github.com/panjf2000/ants
|
||||
```
|
||||
|
||||
### 使用 `ants` v2 版本:
|
||||
|
||||
```powershell
|
||||
go get -u github.com/panjf2000/ants/v2
|
||||
```
|
||||
|
||||
## 使用
|
||||
写 go 并发程序的时候如果程序会启动大量的 goroutine ,势必会消耗大量的系统资源(内存,CPU),通过使用 `ants`,可以实例化一个协程池,复用 goroutine ,节省资源,提升性能:
|
||||
|
||||
|
|
Loading…
Reference in New Issue