Skip to content

Commit 9fd66d0

Browse files
chore: using testing.B.Loop (#2695)
ethereum/go-ethereum#32662 Co-authored-by: julienrbrt <[email protected]>
1 parent bc00cfe commit 9fd66d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

block/internal/cache/bench_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func BenchmarkManager_GetPendingHeaders(b *testing.B) {
6363
ctx := context.Background()
6464
b.ReportAllocs()
6565
b.ResetTimer()
66-
for i := 0; i < b.N; i++ {
66+
for b.Loop() {
6767
hs, err := m.GetPendingHeaders(ctx)
6868
if err != nil {
6969
b.Fatal(err)
@@ -84,7 +84,7 @@ func BenchmarkManager_GetPendingData(b *testing.B) {
8484
ctx := context.Background()
8585
b.ReportAllocs()
8686
b.ResetTimer()
87-
for i := 0; i < b.N; i++ {
87+
for b.Loop() {
8888
ds, err := m.GetPendingData(ctx)
8989
if err != nil {
9090
b.Fatal(err)
@@ -106,7 +106,7 @@ func BenchmarkManager_PendingEventsSnapshot(b *testing.B) {
106106
}
107107
b.ReportAllocs()
108108
b.ResetTimer()
109-
for i := 0; i < b.N; i++ {
109+
for b.Loop() {
110110
ev := m.GetPendingEvents()
111111
if len(ev) == 0 {
112112
b.Fatal("unexpected empty events")

0 commit comments

Comments
 (0)