diff options
author | Miguel Molina <miguel@erizocosmi.co> | 2017-09-04 18:23:26 +0200 |
---|---|---|
committer | Miguel Molina <miguel@erizocosmi.co> | 2017-09-04 18:23:26 +0200 |
commit | 6a46a7eb543789c7012bf0f964e1b6b38eca150c (patch) | |
tree | 13283ed091249f601ceacd7c64a3467c5f4eac78 /plumbing/format/packfile/common.go | |
parent | 770800d980ba7e0af40502324d15ed50445a3291 (diff) | |
download | go-git-6a46a7eb543789c7012bf0f964e1b6b38eca150c.tar.gz |
packfile: improve performance a little by reducing gc pressure
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Diffstat (limited to 'plumbing/format/packfile/common.go')
-rw-r--r-- | plumbing/format/packfile/common.go | 8 |
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) + }, +} |