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

Function BenchmarkIPList_Add

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

Source from the content-addressed store, hash-verified

110}
111
112func BenchmarkIPList_Add(b *testing.B) {
113 runtime.GOMAXPROCS(1)
114
115 var list = waf.NewIPList(waf.IPListTypeDeny)
116 for i := 0; i < b.N; i++ {
117 list.Add(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.1."+strconv.Itoa(i), time.Now().Unix()+3600)
118 }
119 b.Log(len(list.IPMap()))
120}
121
122func BenchmarkIPList_Has(b *testing.B) {
123 runtime.GOMAXPROCS(1)

Callers

nothing calls this directly

Calls 5

NewIPListFunction · 0.92
UnixMethod · 0.80
LogMethod · 0.80
AddMethod · 0.65
IPMapMethod · 0.45

Tested by

no test coverage detected