Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding hs_multi_compile and hs_scan functionality #411

Open
ChiragSharma1 opened this issue Sep 5, 2023 · 1 comment
Open

Regarding hs_multi_compile and hs_scan functionality #411

ChiragSharma1 opened this issue Sep 5, 2023 · 1 comment

Comments

@ChiragSharma1
Copy link

I am having doubt regarding multiple regex scan.
Let say I have 30 different regex patterns to scan on a single buffer and I compile all of them using hs_multi_compile in single database, then used that database in hs_scan, so will hyperscan scan buffer separately for each pattern , or will it scan complete buffer single time for all pattern. (ps. - Point is how many times buffer will be scanned.)

Also if it scan's separately , then how it will be more effective or efficient than compiling all pattern's separately using hs_compile and then calling hs_scan separately for each pattern.

@Markoborodov
Copy link

As I know, Hyperscan searches for all patterns simultaneously. It compiles them into a kind of automata. So, if you need to search for multiple patterns in a buffer, you should use hs_multi_compile to compile them into one pattern database and then scan the buffer by hs_scan: one scan for one buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants