Merge branch 'develop'

This commit is contained in:
andy pan 2018-07-02 14:17:42 +08:00
commit a8314f5774
2 changed files with 4 additions and 1 deletions

View File

@ -176,7 +176,7 @@ Memory : 8 GB 1867 MHz DDR3
**从该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://godoc.org/github.com/panjf2000/ants?status.svg [3]: https://godoc.org/github.com/panjf2000/ants?status.svg
[4]: https://godoc.org/github.com/panjf2000/ants [4]: https://godoc.org/github.com/panjf2000/ants

View File

@ -47,6 +47,8 @@ func demoFunc() error {
} }
func main() { func main() {
defer ants.Release()
runTimes := 1000 runTimes := 1000
// use the common pool // use the common pool
@ -70,6 +72,7 @@ func main() {
wg.Done() wg.Done()
return nil return nil
}) })
defer p.Release()
// submit tasks // submit tasks
for i := 0; i < runTimes; i++ { for i := 0; i < runTimes; i++ {
wg.Add(1) wg.Add(1)