Skip to content

Commit ea5f441

Browse files
committed
Add benchmark for component validation
1 parent d55c284 commit ea5f441

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

multiaddr_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,3 +1132,17 @@ func FuzzSplitRoundtrip(f *testing.F) {
11321132
}
11331133
})
11341134
}
1135+
1136+
func BenchmarkComponentValidation(b *testing.B) {
1137+
comp, err := NewComponent("ip4", "127.0.0.1")
1138+
if err != nil {
1139+
b.Fatal(err)
1140+
}
1141+
b.ReportAllocs()
1142+
for i := 0; i < b.N; i++ {
1143+
_, err := validateComponent(comp)
1144+
if err != nil {
1145+
b.Fatal(err)
1146+
}
1147+
}
1148+
}

0 commit comments

Comments
 (0)