diff options
author | Arran Walker <arran.walker@fiveturns.org> | 2019-04-21 06:36:01 +0000 |
---|---|---|
committer | Arran Walker <arran.walker@fiveturns.org> | 2019-04-22 13:04:36 +0000 |
commit | 936f65dc143f091d5bdb3ee43cf11b06f6635cab (patch) | |
tree | 3dade2832c2968e89c2b6a1ba7e6e17f85aad099 /plumbing/object/commit.go | |
parent | e5268e9c3c94f60e3c2008dc2ab4762c75352bfc (diff) | |
download | go-git-936f65dc143f091d5bdb3ee43cf11b06f6635cab.tar.gz |
plumbing: TreeWalker performance improvement, bufio pool for objects
Removes path.Clean and path.Join, as they're expensive in comparison to basic
string manipulation that can be used here.
Adds bufio.Buffer pool to be used by tag, tree and commit object decoding.
Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
Diffstat (limited to 'plumbing/object/commit.go')
-rw-r--r-- | plumbing/object/commit.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go index b569d3c..511242d 100644 --- a/plumbing/object/commit.go +++ b/plumbing/object/commit.go @@ -171,7 +171,9 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) { } defer ioutil.CheckClose(reader, &err) - r := bufio.NewReader(reader) + r := bufPool.Get().(*bufio.Reader) + defer bufPool.Put(r) + r.Reset(reader) var message bool var pgpsig bool |