From 936f65dc143f091d5bdb3ee43cf11b06f6635cab Mon Sep 17 00:00:00 2001 From: Arran Walker Date: Sun, 21 Apr 2019 06:36:01 +0000 Subject: 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 --- plumbing/object/common.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plumbing/object/common.go (limited to 'plumbing/object/common.go') diff --git a/plumbing/object/common.go b/plumbing/object/common.go new file mode 100644 index 0000000..3591f5f --- /dev/null +++ b/plumbing/object/common.go @@ -0,0 +1,12 @@ +package object + +import ( + "bufio" + "sync" +) + +var bufPool = sync.Pool{ + New: func() interface{} { + return bufio.NewReader(nil) + }, +} -- cgit