aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/common.go
diff options
context:
space:
mode:
authorArran Walker <arran.walker@fiveturns.org>2019-04-21 06:36:01 +0000
committerArran Walker <arran.walker@fiveturns.org>2019-04-22 13:04:36 +0000
commit936f65dc143f091d5bdb3ee43cf11b06f6635cab (patch)
tree3dade2832c2968e89c2b6a1ba7e6e17f85aad099 /plumbing/object/common.go
parente5268e9c3c94f60e3c2008dc2ab4762c75352bfc (diff)
downloadgo-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/common.go')
-rw-r--r--plumbing/object/common.go12
1 files changed, 12 insertions, 0 deletions
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)
+ },
+}