Java 6 pattern matcher performance improvements -
i facing 1 problem java 6 pattern matcher, running matcher against large string (10,000+ characters), site becoming slow.
is there way split strings many strings , speedup performance using java6.
here code, thing matcher pattern variable (blocked words)
the pattern user defined , large text of 100+ words (blocked words)
string text = "very large text file content"; string spamregexpdefinedbyuser = "superman"; pattern pattern = pattern.compile(spamregexpdefinedbyuser, pattern.dotall); matcher matcher = pattern.matcher(text);
you using solution not designed such tasks. should consider usage of trie data structure @fge mentioned. algorithm solves task called aho-corasick.
here existing implementations in java (i've never used of these however):
Comments
Post a Comment