Extract/merge with okf_properties-html-subfilter very-very slow

Issue #242 resolved
Former user created an issue

Original [issue 242](https://code.google.com/p/okapi/issues/detail?id=242) created by mihn... on 2012-06-14T18:22:29.000Z:

What steps will reproduce the problem? 1. Create/select a property file with many entries (let's say 3000) 2. Convert to xlf using okf\_properties-html-subfilter 3. Takes a very long time, about order of magnitude more than plain okf\_properties (or okf\_html)

Using m16 on Windows, but it probably happens on all systems.

Tracked it and the compile method in InlineCodeFinder.java is very slow. And it is caused by the fact that the number of rules keeps growing and growing, so we end up compiling a 200K regexp string (and the string looks like "foo|foo|foo|foo" thousands of times)

The root cause is that rule set is not cleared in AbstractMarkupEventBuilder.java

I am attaching a fix.

To prevent something like this in the future, I wonder if it would be safe to change the ArrayList rules to something that does not allow for doubles (like a Set). With the current use (rules ORed togehter) is is safe.

Comments (1)

  1. Log in to comment