Merge branch 'develop'

This commit is contained in:
Andy Pan 2018-12-01 18:42:02 +08:00
commit 0cc7274a86
5 changed files with 8 additions and 8 deletions

View File

@ -182,9 +182,9 @@ There was only the test of `ants` Pool because my computer was crash when it rea
**As you can see, `ants` can up to 2x~6x faster than goroutines without pool and the memory consumption is reduced by 10 to 20 times.** **As you can see, `ants` can up to 2x~6x faster than goroutines without pool and the memory consumption is reduced by 10 to 20 times.**
[1]: https://travis-ci.com/panjf2000/ants.svg?branch=master [1]: https://travis-ci.com/panjf2000/ants.svg?branch=develop
[2]: https://travis-ci.com/panjf2000/ants [2]: https://travis-ci.com/panjf2000/ants
[3]: https://codecov.io/gh/panjf2000/ants/branch/master/graph/badge.svg [3]: https://codecov.io/gh/panjf2000/ants/branch/develop/graph/badge.svg
[4]: https://codecov.io/gh/panjf2000/ants [4]: https://codecov.io/gh/panjf2000/ants
[5]: https://goreportcard.com/badge/github.com/panjf2000/ants [5]: https://goreportcard.com/badge/github.com/panjf2000/ants
[6]: https://goreportcard.com/report/github.com/panjf2000/ants [6]: https://goreportcard.com/report/github.com/panjf2000/ants

View File

@ -180,9 +180,9 @@ Go1.9
**从该demo测试吞吐性能对比可以看出使用ants的吞吐性能相较于原生goroutine可以保持在2-6倍的性能压制而内存消耗则可以达到10-20倍的节省优势。** **从该demo测试吞吐性能对比可以看出使用ants的吞吐性能相较于原生goroutine可以保持在2-6倍的性能压制而内存消耗则可以达到10-20倍的节省优势。**
[1]: https://travis-ci.com/panjf2000/ants.svg?branch=master [1]: https://travis-ci.com/panjf2000/ants.svg?branch=develop
[2]: https://travis-ci.com/panjf2000/ants [2]: https://travis-ci.com/panjf2000/ants
[3]: https://codecov.io/gh/panjf2000/ants/branch/master/graph/badge.svg [3]: https://codecov.io/gh/panjf2000/ants/branch/develop/graph/badge.svg
[4]: https://codecov.io/gh/panjf2000/ants [4]: https://codecov.io/gh/panjf2000/ants
[5]: https://goreportcard.com/badge/github.com/panjf2000/ants [5]: https://goreportcard.com/badge/github.com/panjf2000/ants
[6]: https://goreportcard.com/report/github.com/panjf2000/ants [6]: https://goreportcard.com/report/github.com/panjf2000/ants

View File

@ -31,9 +31,9 @@ import (
) )
const ( const (
RunTimes = 10000000 RunTimes = 1000000
benchParam = 10 benchParam = 10
benchAntsSize = 100000 benchAntsSize = 200000
) )
func demoFunc() error { func demoFunc() error {

View File

@ -224,7 +224,7 @@ func (p *Pool) putWorker(worker *Worker) {
worker.recycleTime = time.Now() worker.recycleTime = time.Now()
p.lock.Lock() p.lock.Lock()
p.workers = append(p.workers, worker) p.workers = append(p.workers, worker)
//通知有一个空闲的worker // notify there is available worker
p.cond.Signal() p.cond.Signal()
p.lock.Unlock() p.lock.Unlock()
} }

View File

@ -227,7 +227,7 @@ func (p *PoolWithFunc) putWorker(worker *WorkerWithFunc) {
worker.recycleTime = time.Now() worker.recycleTime = time.Now()
p.lock.Lock() p.lock.Lock()
p.workers = append(p.workers, worker) p.workers = append(p.workers, worker)
//通知有一个空闲的worker // notify there is available worker
p.cond.Signal() p.cond.Signal()
p.lock.Unlock() p.lock.Unlock()
} }