aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/parser_test.go
diff options
context:
space:
mode:
authorMiguel Molina <miguel@erizocosmi.co>2018-08-09 10:55:51 +0200
committerMiguel Molina <miguel@erizocosmi.co>2018-08-09 10:55:51 +0200
commit71a3c9161d4d8d2baf16440a86a02e8f5678aef2 (patch)
treeec292c9d738ed7bf2f52a7410872eb9a9ba5df81 /plumbing/format/packfile/parser_test.go
parentb3d995f5ca6b544ed8a48fced85ffa94600af302 (diff)
downloadgo-git-71a3c9161d4d8d2baf16440a86a02e8f5678aef2.tar.gz
plumbing: packfile, read object content only once
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Diffstat (limited to 'plumbing/format/packfile/parser_test.go')
-rw-r--r--plumbing/format/packfile/parser_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/plumbing/format/packfile/parser_test.go b/plumbing/format/packfile/parser_test.go
index b5d482e..012a140 100644
--- a/plumbing/format/packfile/parser_test.go
+++ b/plumbing/format/packfile/parser_test.go
@@ -168,3 +168,28 @@ func BenchmarkParse(b *testing.B) {
})
}
}
+
+func BenchmarkParseBasic(b *testing.B) {
+ if err := fixtures.Init(); err != nil {
+ b.Fatal(err)
+ }
+
+ defer func() {
+ if err := fixtures.Clean(); err != nil {
+ b.Fatal(err)
+ }
+ }()
+
+ f := fixtures.Basic().One()
+ for i := 0; i < b.N; i++ {
+ parser, err := packfile.NewParser(packfile.NewScanner(f.Packfile()))
+ if err != nil {
+ b.Fatal(err)
+ }
+
+ _, err = parser.Parse()
+ if err != nil {
+ b.Fatal(err)
+ }
+ }
+}