MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / BenchmarkIPList_Has

Function BenchmarkIPList_Has

internal/waf/ip_list_test.go:122–135  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

120}
121
122func BenchmarkIPList_Has(b *testing.B) {
123 runtime.GOMAXPROCS(1)
124
125 var list = waf.NewIPList(waf.IPListTypeDeny)
126 b.ResetTimer()
127
128 for i := 0; i < 1_0000; i++ {
129 list.Add(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.1."+strconv.Itoa(i), time.Now().Unix()+3600)
130 }
131
132 for i := 0; i < b.N; i++ {
133 list.Contains(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.1.100")
134 }
135}

Callers

nothing calls this directly

Calls 4

NewIPListFunction · 0.92
UnixMethod · 0.80
AddMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected