2021-11-26 17:56 (UTC+0300), Дмитрий Степанов: > I have approx 5K-10K (5 000 - 10 000) rules. > On average I have 10-20 matches (60 max). > I don't need to insert/delete/update rules frequently - you can consider > rules being permanent which are loaded once on startup.
Never mind my suggestion then. I made a benchmark with your case parameters and even a brute-force scan of all rules outperforms regex database. When Hyperscan performed well in my experience, it was with <100 rules and any single match. Sorry for misdirection and thanks for an interesting algo problem :)