If it’s actually just a list of keywords (no wildcards, character ranges, etc.), I would recommend using Aho-Corasick string matching rather than regular expressions.
Andy > On Dec 13, 2016, at 7:53 AM, David Sofo <[email protected]> wrote: > > Hi, > > For a set of rules expressed in regular expression (around 1000 rules > expected) to find some keywords in a text file (~50Ko each file), how to > speed up the execution time. Currently I compile the regex rule at > initialization time with init function at put them in a map at package level > then run the regex rules with a loop. The regex have this form: > > \b(?:( (A1|A2|A3) | (B1|B2|B3) ) )\b > > spaces are put for readability. A and B are classes of keywords. > > How to speed up the execution: at regular expression level or others levels > (such execution priority). I am using Ubuntu 14.04. Any suggestion is > welcome. Thank you. > > Here a code > > Regards > David > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
