Skip to content

Commit 26a4da3

Browse files
Use b.Loop for benchmarks
1 parent 34a065c commit 26a4da3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/server/router_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,19 +442,19 @@ func BenchmarkHostServiceMap_WilcardRouting(b *testing.B) {
442442
}
443443

444444
b.Run("exact match", func(b *testing.B) {
445-
for i := 0; i < b.N; i++ {
445+
for b.Loop() {
446446
_ = hsm.ServiceForHost("one.example.com")
447447
}
448448
})
449449

450450
b.Run("wildcard match", func(b *testing.B) {
451-
for i := 0; i < b.N; i++ {
451+
for b.Loop() {
452452
_ = hsm.ServiceForHost("anything.two.example.com")
453453
}
454454
})
455455

456456
b.Run("default match", func(b *testing.B) {
457-
for i := 0; i < b.N; i++ {
457+
for b.Loop() {
458458
_ = hsm.ServiceForHost("missing.example.com")
459459
}
460460
})

0 commit comments

Comments
 (0)