Commit fa85dd80 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Generate less garbage: use fixed buffer for DiscardAll.

parent a55a3b79
......@@ -63,8 +63,9 @@ func (me *pairPool) get() (p *Pair, err error) {
return newSplicePair()
}
var discardBuffer [32*1024]byte
func DiscardAll(r io.Reader) {
buf := make([]byte, 32*1024)
buf := discardBuffer[:]
for {
n, _ := r.Read(buf)
if n < len(buf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment