Skip to content

Commit d4a3345

Browse files
authored
Merge branch 'main' into patch-1
2 parents e0543c9 + fc6df7e commit d4a3345

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

codec/bench_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func BenchmarkLegacyGetSigners(b *testing.B) {
3333
Amount: nil,
3434
}}
3535

36-
b.ResetTimer()
37-
for i := 0; i < b.N; i++ {
36+
for b.Loop() {
3837
_ = msg.GetSigners()
3938
}
4039
}
@@ -50,8 +49,7 @@ func BenchmarkProtoreflectGetSigners(b *testing.B) {
5049
Amount: nil,
5150
}
5251

53-
b.ResetTimer()
54-
for i := 0; i < b.N; i++ {
52+
for b.Loop() {
5553
_, err := signingCtx.GetSigners(msg)
5654
if err != nil {
5755
panic(err)
@@ -72,8 +70,7 @@ func BenchmarkProtoreflectGetSignersWithUnmarshal(b *testing.B) {
7270
a, err := codectypes.NewAnyWithValue(msg)
7371
require.NoError(b, err)
7472

75-
b.ResetTimer()
76-
for i := 0; i < b.N; i++ {
73+
for b.Loop() {
7774
_, _, err := cdc.GetMsgAnySigners(a)
7875
if err != nil {
7976
panic(err)
@@ -97,8 +94,7 @@ func BenchmarkProtoreflectGetSignersDynamicpb(b *testing.B) {
9794
err = protov2.Unmarshal(bz, dynamicmsg)
9895
require.NoError(b, err)
9996

100-
b.ResetTimer()
101-
for i := 0; i < b.N; i++ {
97+
for b.Loop() {
10298
_, err := signingCtx.GetSigners(dynamicmsg)
10399
if err != nil {
104100
panic(err)

codec/proto_codec_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,9 @@ func BenchmarkProtoCodecMarshalLengthPrefixed(b *testing.B) {
165165
}),
166166
}
167167

168-
b.ResetTimer()
169168
b.ReportAllocs()
170169

171-
for i := 0; i < b.N; i++ {
170+
for b.Loop() {
172171
blob, err := pCdc.MarshalLengthPrefixed(msg)
173172
if err != nil {
174173
b.Fatal(err)

0 commit comments

Comments
 (0)