mirror of https://github.com/panjf2000/ants.git
Update comment
This commit is contained in:
parent
001c8b5e1b
commit
21f632368a
9
ants.go
9
ants.go
|
@ -76,16 +76,15 @@ var (
|
|||
// to get the best performance. Inspired by fasthttp at
|
||||
// https://github.com/valyala/fasthttp/blob/master/workerpool.go#L139
|
||||
workerChanCap = func() int {
|
||||
// Use blocking workerChan if GOMAXPROCS=1.
|
||||
// This immediately switches Serve to WorkerFunc, which results
|
||||
// in higher performance (under go1.5 at least).
|
||||
// Use blocking channel if GOMAXPROCS=1.
|
||||
// This switches context from sender to receiver immediately,
|
||||
// which results in higher performance (under go1.5 at least).
|
||||
if runtime.GOMAXPROCS(0) == 1 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// Use non-blocking workerChan if GOMAXPROCS>1,
|
||||
// since otherwise the Serve caller (Acceptor) may lag accepting
|
||||
// new connections if WorkerFunc is CPU-bound.
|
||||
// since otherwise the sender might be dragged down if the receiver is CPU-bound.
|
||||
return 1
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in New Issue