optimize: memory occupation

This commit is contained in:
mzz2017
2023-02-18 21:39:46 +08:00
parent 5806f9bb39
commit b277212715
6 changed files with 239 additions and 132 deletions

View File

@ -195,14 +195,14 @@ func BenchmarkGoRegexpNfa(b *testing.B) {
runBenchmark(b, nfa)
}
func BenchmarkAhocorasick(b *testing.B) {
func BenchmarkAhocorasickSuccinctset(b *testing.B) {
b.StopTimer()
logrus.SetLevel(logrus.WarnLevel)
simulatedDomainSet, err := getDomain()
if err != nil {
b.Fatal(err)
}
ahocorasick := NewAhocorasick(consts.MaxMatchSetLen)
ahocorasick := NewAhocorasickSuccinctset(consts.MaxMatchSetLen)
for _, domains := range simulatedDomainSet {
ahocorasick.AddSet(domains.RuleIndex, domains.Domains, domains.Key)
}