aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/common.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-09-04 19:43:36 +0200
committerGitHub <noreply@github.com>2017-09-04 19:43:36 +0200
commitf9879dd043f84936a1f8acb8a53b74332a7ae135 (patch)
tree13283ed091249f601ceacd7c64a3467c5f4eac78 /plumbing/format/packfile/common.go
parent770800d980ba7e0af40502324d15ed50445a3291 (diff)
parent6a46a7eb543789c7012bf0f964e1b6b38eca150c (diff)
downloadgo-git-f9879dd043f84936a1f8acb8a53b74332a7ae135.tar.gz
Merge pull request #578 from erizocosmico/perf/reduce-gc-pressv4.0.0-rc15
packfile: improve performance a little by reducing gc pressure
Diffstat (limited to 'plumbing/format/packfile/common.go')
-rw-r--r--plumbing/format/packfile/common.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/plumbing/format/packfile/common.go b/plumbing/format/packfile/common.go
index 728cb16..7dad1f6 100644
--- a/plumbing/format/packfile/common.go
+++ b/plumbing/format/packfile/common.go
@@ -1,7 +1,9 @@
package packfile
import (
+ "bytes"
"io"
+ "sync"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/utils/ioutil"
@@ -49,3 +51,9 @@ func writePackfileToObjectStorage(sw storer.PackfileWriter, packfile io.Reader)
_, err = io.Copy(w, packfile)
return err
}
+
+var bufPool = sync.Pool{
+ New: func() interface{} {
+ return bytes.NewBuffer(nil)
+ },
+}