2018-05-19 10:57:04 +03:00
|
|
|
package ants_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"github.com/panjf2000/ants"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkPoolGroutine(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2018-05-19 11:10:38 +03:00
|
|
|
ants.Push(demoFunc)
|
2018-05-19 10:57:04 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-19 11:10:38 +03:00
|
|
|
//func BenchmarkPoolGroutine(b *testing.B) {
|
|
|
|
// p := ants.NewPool(size)
|
|
|
|
// b.ResetTimer()
|
|
|
|
// for i := 0; i < b.N; i++ {
|
|
|
|
// p.Push(demoFunc)
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2018-05-19 10:57:04 +03:00
|
|
|
func BenchmarkGoroutine(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
go demoFunc()
|
|
|
|
}
|
|
|
|
}
|