You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Buffer:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Search:[A-Z0-9]+([A-Z0-9._%+-]*)+@[A-Z0-9.-]+\.[A-Z]{2,4} Options: Regex, Case insensitive, No word Boundary.
Search make atom freeze with 100% CPU, no decoration or large buffer involved. After some time, 'editor is unresponsive' popup appears.
Example regex is a real life (bad) email regex found on stackoverflow. Problem start while trying to match @. Because search can't find @, regex backtrack. The problem then is ([]*)+ pattern which basically mean: any amount of group containing any amount of character. And there's ton of permutation of that ! Nevertheless regex engine will examine every on of them just in case one permutation will free up a @.
One interesting bit of information is that Atom use oniguruma for syntax coloring, which support async search with callback. This might be a relatively cheap route for implementing search in a separate thread.
Alternative one could be to try to sanitize the regex.
The text was updated successfully, but these errors were encountered:
Buffer:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Search:
[A-Z0-9]+([A-Z0-9._%+-]*)+@[A-Z0-9.-]+\.[A-Z]{2,4}
Options: Regex, Case insensitive, No word Boundary.
Search make atom freeze with 100% CPU, no decoration or large buffer involved. After some time, 'editor is unresponsive' popup appears.
Example regex is a real life (bad) email regex found on stackoverflow. Problem start while trying to match
@
. Because search can't find@
, regex backtrack. The problem then is([]*)+
pattern which basically mean: any amount of group containing any amount of character. And there's ton of permutation of that ! Nevertheless regex engine will examine every on of them just in case one permutation will free up a@
.Maybe the suggestion to use a separate thread for searching is not all bad.
One interesting bit of information is that Atom use oniguruma for syntax coloring, which support async search with callback. This might be a relatively cheap route for implementing search in a separate thread.
Alternative one could be to try to sanitize the regex.
The text was updated successfully, but these errors were encountered: