forked from mirror/ants
Merge branch 'develop'
This commit is contained in:
commit
0cc7274a86
|
@ -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.**
|
||||
|
||||
[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
|
||||
[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
|
||||
[5]: https://goreportcard.com/badge/github.com/panjf2000/ants
|
||||
[6]: https://goreportcard.com/report/github.com/panjf2000/ants
|
||||
|
|
|
@ -180,9 +180,9 @@ Go1.9
|
|||
|
||||
**从该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
|
||||
[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
|
||||
[5]: https://goreportcard.com/badge/github.com/panjf2000/ants
|
||||
[6]: https://goreportcard.com/report/github.com/panjf2000/ants
|
||||
|
|
|
@ -31,9 +31,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
RunTimes = 10000000
|
||||
RunTimes = 1000000
|
||||
benchParam = 10
|
||||
benchAntsSize = 100000
|
||||
benchAntsSize = 200000
|
||||
)
|
||||
|
||||
func demoFunc() error {
|
||||
|
|
2
pool.go
2
pool.go
|
@ -224,7 +224,7 @@ func (p *Pool) putWorker(worker *Worker) {
|
|||
worker.recycleTime = time.Now()
|
||||
p.lock.Lock()
|
||||
p.workers = append(p.workers, worker)
|
||||
//通知有一个空闲的worker
|
||||
// notify there is available worker
|
||||
p.cond.Signal()
|
||||
p.lock.Unlock()
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ func (p *PoolWithFunc) putWorker(worker *WorkerWithFunc) {
|
|||
worker.recycleTime = time.Now()
|
||||
p.lock.Lock()
|
||||
p.workers = append(p.workers, worker)
|
||||
//通知有一个空闲的worker
|
||||
// notify there is available worker
|
||||
p.cond.Signal()
|
||||
p.lock.Unlock()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue