Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Commit eef76cd

Browse files
committed
Remove init time
1 parent 96af092 commit eef76cd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test:
3737

3838
.PHONY: bench
3939
bench:
40-
go test -run=XXX -bench=. || exit 1
40+
go test -run=XXXXXX -benchtime=10s -bench=. || exit 1
4141

4242
.PHONY: build
4343
build:

tree_entry_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func setupGitRepo(url string) string {
14-
1514
dir, err := ioutil.TempDir("", "gitea-bench")
1615
if err != nil {
1716
panic(err)
@@ -30,7 +29,8 @@ func setupGitRepo(url string) string {
3029
}
3130

3231
func benchmarkGetCommitsInfo(url string, b *testing.B) {
33-
32+
b.StopTimer()
33+
3434
// setup env
3535
repoPath := setupGitRepo(url)
3636
defer os.RemoveAll(repoPath)
@@ -51,6 +51,7 @@ func benchmarkGetCommitsInfo(url string, b *testing.B) {
5151
}
5252
entries.Sort()
5353

54+
b.StartTimer()
5455
// run the GetCommitsInfo function b.N times
5556
for n := 0; n < b.N; n++ {
5657
_, err = entries.GetCommitsInfo(commit, "")

0 commit comments

Comments
 (0)