Author Topic: Extreme slowness when searching for regular expression of a certain type  (Read 1206 times)

Offline Andreas

  • Registered User
  • Jr. Member
  • *
  • Posts: 53
  • Karma: +0/-0
    • View Profile
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Extreme slowness when searching for regular expression of a certain type
« Reply #1 on: October 13, 2014, 07:10:34 pm »
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.

Offline Andreas

  • Registered User
  • Jr. Member
  • *
  • Posts: 53
  • Karma: +0/-0
    • View Profile
Re: Extreme slowness when searching for regular expression of a certain type
« Reply #2 on: October 13, 2014, 09:03:31 pm »
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

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Extreme slowness when searching for regular expression of a certain type
« Reply #3 on: October 13, 2014, 11:05:19 pm »
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!!! ;)

Offline Andreas

  • Registered User
  • Jr. Member
  • *
  • Posts: 53
  • Karma: +0/-0
    • View Profile
Re: Extreme slowness when searching for regular expression of a certain type
« Reply #4 on: October 14, 2014, 07:26:27 am »
Hi Alex,

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

Best regards,
Andreas

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
3413 Views
Last post January 31, 2009, 10:03:18 pm
by alex
10 Replies
5827 Views
Last post June 30, 2010, 07:58:52 am
by Stefan
3 Replies
2344 Views
Last post January 22, 2009, 03:40:27 pm
by Stefan
3 Replies
2426 Views
Last post February 03, 2009, 10:08:20 pm
by Stefan
5 Replies
2534 Views
Last post January 21, 2012, 06:37:41 pm
by alex