Extreme slowness when searching for regular expression of a certain type

Started by Andreas, October 13, 2014, 11:50:45 AM

Previous topic - Next topic

Andreas

Hippoedit becomes extremely slow when searching for a regular expression of the form  <frequent string> <any string> <seldom string>. Here is an example of such a regular expression:

a.*bkstfwxlhsdgdhlsgfdgsf

EmEditor and EditPad Pro do not have any problems with this kind of regular expressions.

Maybe this is not exactly a bug, but at least it's a bad implementation, which effectively makes HippoEdit unusable for me in the case where I need to search for such a regular expression.

alex

Hi Andreas,

there is no special logic around this. Details about implementation algorithm of regexp processing you can find on boost website http://www.boost.org/doc/libs/1_53_0/libs/regex/doc/html/index.html.

Cam be that EmEditor and EditPad use different regular expression engine that does not support greedy request as you one, and treat it as non greedy. Or limit to lien scope.
Try to modify it to non greedy (I do not think that you really want greedy version): a.*?bkstfwxlhsdgdhlsgfdgsf

If does not help, I can check once more, but than I need reproducible example.

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Andreas

Hi Alex,

okay, thanks for the explanation. Previously, I didn't even know what Greedy means. Adding the question mark to my regular expression, as you suggested, fixed the slowness problem.

I've made some further tests with EmEditor and EditPad Pro. They both support Greedy. And by default they both limit to line scope, which is the reason why they don't have the slowness problem with my original regular expression. And they both have an option by which you can choose whether the dot will match a newline character. In EmEditor, this option had no effect in my tests. In EditPad Pro, it behaved as expected. When I turned the option ON, search became much slower (but still not as slow as in HippoEdit).

So to summarize, there is no bug in HippoEdit here. And as a future enhancement suggestion, maybe you could add an option "dot will match newline character". I would turn that option OFF by default.

Best regards,
Andreas

alex

Hi Andreas,

actually I am trying to simplify and reduce number of options everywhere (especially in search dialog - it "lost" several not used options in 1.51). So, I will be strongly against of any not highly requested UI feature flag in search dialog.

But nevertheless, you can use new global XML flag for that.

BR, Alex.
P.S: Thanks you very much Alex!!! ;)
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Andreas

Hi Alex,

thank you for the new flag. I'm looking forward to build 1.51.35  :)

Best regards,
Andreas