Skip to content

Commit 2e51b7c

Browse files
committed
style: Optimize test
Change-Id: I571f966ebe052ba2fff41eae7ef817e57fbde500
1 parent c8a98d0 commit 2e51b7c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tagexpr_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
)
2323

2424
func BenchmarkTagExpr(b *testing.B) {
25-
b.StopTimer()
2625
type T struct {
2726
a int `bench:"$%3"`
2827
}
@@ -32,7 +31,7 @@ func BenchmarkTagExpr(b *testing.B) {
3231
b.Fatal(err)
3332
}
3433
b.ReportAllocs()
35-
b.StartTimer()
34+
b.ResetTimer()
3635
var t = &T{10}
3736
for i := 0; i < b.N; i++ {
3837
tagExpr, err := vm.Run(t)
@@ -46,12 +45,11 @@ func BenchmarkTagExpr(b *testing.B) {
4645
}
4746

4847
func BenchmarkReflect(b *testing.B) {
49-
b.StopTimer()
5048
type T struct {
5149
a int `remainder:"3"`
5250
}
5351
b.ReportAllocs()
54-
b.StartTimer()
52+
b.ResetTimer()
5553
var t = &T{1}
5654
for i := 0; i < b.N; i++ {
5755
v := reflect.ValueOf(t).Elem()

0 commit comments

Comments
 (0)