performance: added wrapper around io.Copy()

this pools copy buffers so they can be reused instead of throwing away
after each io.Copy()
This commit is contained in:
Jarek Kowalski
2020-03-10 17:31:56 -07:00
parent ec56ed3d70
commit 514df69afa
16 changed files with 63 additions and 26 deletions

View File

@@ -13,6 +13,7 @@
"github.com/pkg/errors"
"github.com/kopia/kopia/fs"
"github.com/kopia/kopia/internal/iocopy"
"github.com/kopia/kopia/repo/logging"
"github.com/kopia/kopia/repo/object"
)
@@ -280,7 +281,7 @@ func downloadFile(ctx context.Context, f fs.File, fname string) error {
}
defer dst.Close() //nolint:errcheck
_, err = io.Copy(dst, src)
_, err = iocopy.Copy(dst, src)
return err
}