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

Function BenchmarkMatchStringCache

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

Source from the content-addressed store, hash-verified

57}
58
59func BenchmarkMatchStringCache(b *testing.B) {
60 runtime.GOMAXPROCS(1)
61
62 var data = strings.Repeat("HELLO", 128)
63 var regex = re.MustCompile(`(?iU)\b(eval|system|exec|execute|passthru|shell_exec|phpinfo)\b`)
64 //b.Log(regex.Keywords())
65 _ = utils.MatchStringCache(regex, data, utils.CacheShortLife)
66
67 for i := 0; i < b.N; i++ {
68 _ = utils.MatchStringCache(regex, data, utils.CacheShortLife)
69 }
70}
71
72func BenchmarkMatchStringCache_LowHit(b *testing.B) {
73 runtime.GOMAXPROCS(1)

Callers

nothing calls this directly

Calls 2

MustCompileFunction · 0.92
MatchStringCacheFunction · 0.92

Tested by

no test coverage detected