From 5598068360a39a61d97887522e474323d8f78f97 Mon Sep 17 00:00:00 2001 From: Arran Walker Date: Sun, 21 Apr 2019 12:35:35 +0000 Subject: 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 --- storage/filesystem/index.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'storage/filesystem/index.go') 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 } -- cgit