diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-11-11 15:16:52 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-11-11 15:16:52 +0200 |
commit | 89fe89ae7451443b184bf5796e11ff0e4e5480d1 (patch) | |
tree | 99c493300d01f3df5c16df13192da33592aee82f /stackless | |
parent | Issue #173: improve error messages on headers parsing (diff) | |
download | fasthttp-89fe89ae7451443b184bf5796e11ff0e4e5480d1.tar.gz fasthttp-89fe89ae7451443b184bf5796e11ff0e4e5480d1.tar.bz2 fasthttp-89fe89ae7451443b184bf5796e11ff0e4e5480d1.zip |
stackless: optimization: do not issue zero-length writes to underlying writer
Diffstat (limited to 'stackless')
-rw-r--r-- | stackless/doc.go | 4 | ||||
-rw-r--r-- | stackless/writer.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/stackless/doc.go b/stackless/doc.go index 37591dd..ca02615 100644 --- a/stackless/doc.go +++ b/stackless/doc.go @@ -1,3 +1,3 @@ -// Package stackless saves stack space when using writers from compress/* -// packages. +// Package stackless saves stack space for high number of concurrently +// running goroutines, which use writers from compress/* packages. package stackless diff --git a/stackless/writer.go b/stackless/writer.go index 18c3e62..3910081 100644 --- a/stackless/writer.go +++ b/stackless/writer.go @@ -27,7 +27,7 @@ type NewWriterFunc func(w io.Writer) Writer // The returned writer writes data to dstW. // // Writers that use a lot of stack space may be wrapped into stackless writer, -// thus saving stack space. +// thus saving stack space for high number of concurrently running goroutines. func NewWriter(dstW io.Writer, newWriter NewWriterFunc) Writer { w := &writer{ dstW: dstW, @@ -86,7 +86,7 @@ func (w *writer) do(op op) error { if err != nil { return err } - if w.xw.bb != nil { + if w.xw.bb != nil && len(w.xw.bb.B) > 0 { _, err = w.dstW.Write(w.xw.bb.B) } w.xw.Reset() |