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

Function BenchmarkMatchStringCache_LowHit

internal/waf/utils/utils_test.go:72–82  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

70}
71
72func BenchmarkMatchStringCache_LowHit(b *testing.B) {
73 runtime.GOMAXPROCS(1)
74
75 var regex = re.MustCompile(`(?iU)\b(eval|system|exec|execute|passthru|shell_exec|phpinfo)\b`)
76 //b.Log(regex.Keywords())
77
78 for i := 0; i < b.N; i++ {
79 var data = strings.Repeat("A", rands.Int(0, 100))
80 _ = utils.MatchStringCache(regex, data, utils.CacheShortLife)
81 }
82}
83
84func BenchmarkMatchStringCache_WithoutCache(b *testing.B) {
85 runtime.GOMAXPROCS(1)

Callers

nothing calls this directly

Calls 2

MustCompileFunction · 0.92
MatchStringCacheFunction · 0.92

Tested by

no test coverage detected