Skip to content

Commit

Permalink
netutil: add bench results
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Apr 1, 2024
1 parent 06ea584 commit 2621db3
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions netutil/reversed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ func BenchmarkSubnetFromReversedAddr(b *testing.B) {
}

func BenchmarkExtractReversedAddr(b *testing.B) {
const serviceLabel = "_srv."

benchCases := []struct {
name string
in string
Expand All @@ -704,7 +706,7 @@ func BenchmarkExtractReversedAddr(b *testing.B) {
in: ipv4NetRevGood,
}, {
name: "ipv4_subnet_within_domain",
in: "a." + ipv4NetRevGood,
in: serviceLabel + ipv4NetRevGood,
}, {
name: "ipv6_root",
in: ipv6Suffix[len("."):],
Expand All @@ -713,7 +715,7 @@ func BenchmarkExtractReversedAddr(b *testing.B) {
in: ipv6NetRevGood,
}, {
name: "ipv6_subnet_within_domain",
in: "_srv." + ipv6NetRevGood,
in: serviceLabel + ipv6NetRevGood,
}}

for _, bc := range benchCases {
Expand All @@ -729,4 +731,15 @@ func BenchmarkExtractReversedAddr(b *testing.B) {
require.NoError(b, errSink)
})
}

// goos: darwin
// goarch: amd64
// pkg: github.com/AdguardTeam/golibs/netutil
// cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
// BenchmarkExtractReversedAddr/ipv4_root-12 48763834 117.1 ns/op 0 B/op 0 allocs/op
// BenchmarkExtractReversedAddr/ipv4_subnet-12 30052669 196.0 ns/op 0 B/op 0 allocs/op
// BenchmarkExtractReversedAddr/ipv4_subnet_within_domain-12 19392285 309.2 ns/op 52 B/op 2 allocs/op
// BenchmarkExtractReversedAddr/ipv6_root-12 49988905 126.5 ns/op 0 B/op 0 allocs/op
// BenchmarkExtractReversedAddr/ipv6_subnet-12 7056574 837.6 ns/op 0 B/op 0 allocs/op
// BenchmarkExtractReversedAddr/ipv6_subnet_within_domain-12 6529401 915.3 ns/op 0 B/op 0 allocs/op
}

0 comments on commit 2621db3

Please sign in to comment.