diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-04-23 09:04:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-23 09:04:45 +0200 |
commit | 54ff89f7da9e0670ef348c6192291c336a967baf (patch) | |
tree | ba4e225caca199f6f8d458d802f6f5a5e52564aa /plumbing/format/packfile/common.go | |
parent | eb243ba9a55ac029ab3f9b15157920c46e24078b (diff) | |
parent | 9d4279fd355c1777e0884075f9e64576ddea1a76 (diff) | |
download | go-git-54ff89f7da9e0670ef348c6192291c336a967baf.tar.gz |
Merge pull request #1124 from saracen/packfile-scanner-improved-reader
plumbing: packfile/scanner, readability/performance improvements, zlib pooling
Diffstat (limited to 'plumbing/format/packfile/common.go')
-rw-r--r-- | plumbing/format/packfile/common.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plumbing/format/packfile/common.go b/plumbing/format/packfile/common.go index 0d9ed54..f82c1ab 100644 --- a/plumbing/format/packfile/common.go +++ b/plumbing/format/packfile/common.go @@ -2,6 +2,7 @@ package packfile import ( "bytes" + "compress/zlib" "io" "sync" @@ -66,3 +67,12 @@ var bufPool = sync.Pool{ return bytes.NewBuffer(nil) }, } + +var zlibInitBytes = []byte{0x78, 0x9c, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01} + +var zlibReaderPool = sync.Pool{ + New: func() interface{} { + r, _ := zlib.NewReader(bytes.NewReader(zlibInitBytes)) + return r + }, +} |