copy using bytes pools
Vendor and use docker/pkg/pools. pools are used to lower the number of memory allocations and reuse buffers when processing large streams operations.. The use of pools.Copy avoids io.Copy's internal buffer allocation. This commit replaces io.Copy with pools.Copy to avoid the allocation of buffers in io.Copy. Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
0b2f6b5354
commit
b211061016
4 changed files with 124 additions and 5 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/kubernetes-incubator/cri-o/oci"
|
||||
"github.com/kubernetes-incubator/cri-o/utils"
|
||||
"golang.org/x/net/context"
|
||||
|
@ -108,7 +109,7 @@ func redirectResponseToOutputStream(tty bool, outputStream, errorStream io.Write
|
|||
}
|
||||
var err error
|
||||
if tty {
|
||||
_, err = io.Copy(outputStream, conn)
|
||||
_, err = pools.Copy(outputStream, conn)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue