aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem
diff options
context:
space:
mode:
authorArran Walker <arran.walker@fiveturns.org>2019-04-21 12:35:35 +0000
committerArran Walker <arran.walker@fiveturns.org>2019-04-21 14:38:51 +0000
commit5598068360a39a61d97887522e474323d8f78f97 (patch)
tree172273171aecb62b97b2c17b7b2c82211cfd131b /storage/filesystem
parente5268e9c3c94f60e3c2008dc2ab4762c75352bfc (diff)
downloadgo-git-5598068360a39a61d97887522e474323d8f78f97.tar.gz
plumbing: format/index perf, buffered reads, reflection removal
Large performance increase by buffering reads. There were a few instances where binary.Read() would end up using reflection on &plumbing.Hash, rather than treating it as a byte slice. This has now been resolved. Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
Diffstat (limited to 'storage/filesystem')
-rw-r--r--storage/filesystem/index.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/storage/filesystem/index.go b/storage/filesystem/index.go
index 2ebf57e..d04195c 100644
--- a/storage/filesystem/index.go
+++ b/storage/filesystem/index.go
@@ -1,6 +1,7 @@
package filesystem
import (
+ "bufio"
"os"
"gopkg.in/src-d/go-git.v4/plumbing/format/index"
@@ -41,7 +42,7 @@ func (s *IndexStorage) Index() (i *index.Index, err error) {
defer ioutil.CheckClose(f, &err)
- d := index.NewDecoder(f)
+ d := index.NewDecoder(bufio.NewReader(f))
err = d.Decode(idx)
return idx, err
}