Update comment

This commit is contained in:
Andy Pan 2020-08-21 14:08:49 +08:00
parent 001c8b5e1b
commit 21f632368a
1 changed files with 4 additions and 5 deletions

View File

@ -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
}()