High CPU load when searching for /.+.+aa/ regex

Found a bug in "Everything"? report it here
Post Reply
MrCricket
Posts: 2
Joined: Tue Aug 31, 2021 5:10 pm

High CPU load when searching for /.+.+aa/ regex

Post by MrCricket » Tue Aug 31, 2021 5:21 pm

Hi,

The App looks stuck with 100% cpu load (8 cores) when searching for this (bad?) regex:

Code: Select all

.+.+aa
It this expected?

My Search settings are
  • Match Path
  • Enable Regex
  • Everything

void
Site Admin
Posts: 7534
Joined: Fri Oct 16, 2009 11:31 pm

Re: High CPU load when searching for /.+.+aa/ regex

Post by void » Tue Aug 31, 2021 11:44 pm

This is expected.

The two .+ patterns are a recursive nightmare.
Additional .+ patterns exacerbates the issue.


For improved performance, minimize the number of * modifiers or use a literal pattern between the two * modifiers.
For the same results, please try the following search:

..aa

Regex matches anywhere in the text, to match from the start of the text:
^...*aa


A similar issue with wildcards:

*?*?*aa*

MrCricket
Posts: 2
Joined: Tue Aug 31, 2021 5:10 pm

Re: High CPU load when searching for /.+.+aa/ regex

Post by MrCricket » Thu Sep 02, 2021 9:35 am

void wrote:
Tue Aug 31, 2021 11:44 pm
The two .+ patterns are a recursive nightmare.
Additional .+ patterns exacerbates the issue.
right - it was a misprint, I meant /.+aa/
void wrote:
Tue Aug 31, 2021 11:44 pm
This is expected.
I think it would be great if the App could detect such cases proposing to cancel the search after some time (10 seconds? can be optional/configurable in Settings)

Thanks!

void
Site Admin
Posts: 7534
Joined: Fri Oct 16, 2009 11:31 pm

Re: High CPU load when searching for /.+.+aa/ regex

Post by void » Thu Sep 02, 2021 10:19 am

right - it was a misprint, I meant /.+aa/
path:regex:.+aa

is still quite slow because Everything will attempt to find the regex pattern anywhere in the filename.
(it's still a recursive nightmare)

path:regex:.aa would produce the same results much faster.


Maybe Everything could look at optimizing .+aa to .aa or ^.+aa
Although, .aa would affect highlighting.
I think it would be great if the App could detect such cases proposing to cancel the search after some time (10 seconds? can be optional/configurable in Settings)
I will consider an option to do this.
Thank you for the suggestion.

For now, the search can be cancelled by:
  • Clearing the search box.
  • Typing in a new search.

Post Reply