|
|
@ -17,6 +17,7 @@ func BenchmarkGetCommitGraph(b *testing.B) { |
|
|
|
b.Error("Could not open repository") |
|
|
|
b.Error("Could not open repository") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ { |
|
|
|
graph, err := GetCommitGraph(currentRepo) |
|
|
|
graph, err := GetCommitGraph(currentRepo) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
b.Error("Could get commit graph") |
|
|
|
b.Error("Could get commit graph") |
|
|
@ -25,11 +26,13 @@ func BenchmarkGetCommitGraph(b *testing.B) { |
|
|
|
if len(graph) < 100 { |
|
|
|
if len(graph) < 100 { |
|
|
|
b.Error("Should get 100 log lines.") |
|
|
|
b.Error("Should get 100 log lines.") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func BenchmarkParseCommitString(b *testing.B) { |
|
|
|
func BenchmarkParseCommitString(b *testing.B) { |
|
|
|
testString := "* DATA:||4e61bacab44e9b4730e44a6615d04098dd3a8eaf|2016-12-20 21:10:41 +0100|Kjell Kvinge|kjell@kvinge.biz|4e61bac|Add route for graph" |
|
|
|
testString := "* DATA:||4e61bacab44e9b4730e44a6615d04098dd3a8eaf|2016-12-20 21:10:41 +0100|Kjell Kvinge|kjell@kvinge.biz|4e61bac|Add route for graph" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ { |
|
|
|
graphItem, err := graphItemFromString(testString, nil) |
|
|
|
graphItem, err := graphItemFromString(testString, nil) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
b.Error("could not parse teststring") |
|
|
|
b.Error("could not parse teststring") |
|
|
@ -38,4 +41,5 @@ func BenchmarkParseCommitString(b *testing.B) { |
|
|
|
if graphItem.Author != "Kjell Kvinge" { |
|
|
|
if graphItem.Author != "Kjell Kvinge" { |
|
|
|
b.Error("Did not get expected data") |
|
|
|
b.Error("Did not get expected data") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|