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):

https://github.com/raymanrt/aho-corasick

https://github.com/robert-bor/aho-corasick


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -