Skip to content

Commit

Permalink
Add benchmark for component validation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Feb 6, 2025
1 parent 8129048 commit 55da517
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions multiaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,3 +1132,17 @@ func FuzzSplitRoundtrip(f *testing.F) {
}
})
}

func BenchmarkComponentValidation(b *testing.B) {
comp, err := NewComponent("ip4", "127.0.0.1")
if err != nil {
b.Fatal(err)
}
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_, err := validateComponent(comp)
if err != nil {
b.Fatal(err)
}
}
}

0 comments on commit 55da517

Please sign in to comment.