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.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Textmate grammar freezes with long string constant #207
the [\\w\\s]* and \\b(?:class|(?<!@)interface|enum)\\s+ clashes quite badly causing catastrophic backtracking when no class/record is found on a standalone word
combine that with the begin rule is a 0width lookahead with no outside anchoring points
not a good recipe for performance
changing (?=\\w?[\\w\\s-]*\\b(?:class|(?<!@)interface|enum)\\s+[\\w$]+)
to (?=(?>(?!\\b(?>class|(?<!@)interface|enum)\\s)\\w++|[\\w\\s-&&[^cei]]++)*+\\b(?>class|(?<!@)interface|enum)\\s+[\\w$])
helps out alot, but does not remove the lag entirely
and the same for record: (?=\\w?[\\w\\s]*\\b(?:record)\\s+[\\w$]+)
=> (?=(?>(?!\\brecord\\s)\\w++|[\\w\\s&&[^r]]++)*+\\brecord\\s+[\\w$])
Activity
sadikovi commentedon Oct 23, 2019
Thanks for reporting, I will have a look.
sadikovi commentedon Oct 28, 2019
I root caused the issue - variable pattern causes the problem, will try fixing it.
RedCMD commentedon Dec 2, 2022
Seems to be caused by
class:language-java/grammars/java.cson
Lines 279 to 367 in 047fd33
and
record:language-java/grammars/java.cson
Lines 1286 to 1348 in 047fd33
Commenting both out reduces lag massively
RedCMD commentedon Dec 3, 2022
the
[\\w\\s]*and\\b(?:class|(?<!@)interface|enum)\\s+clashes quite badly causing catastrophic backtracking when no class/record is found on a standalone wordcombine that with the
beginrule is a 0width lookahead with no outside anchoring pointsnot a good recipe for performance
changing
(?=\\w?[\\w\\s-]*\\b(?:class|(?<!@)interface|enum)\\s+[\\w$]+)to
(?=(?>(?!\\b(?>class|(?<!@)interface|enum)\\s)\\w++|[\\w\\s-&&[^cei]]++)*+\\b(?>class|(?<!@)interface|enum)\\s+[\\w$])helps out alot, but does not remove the lag entirely
and the same for
record:(?=\\w?[\\w\\s]*\\b(?:record)\\s+[\\w$]+)=>
(?=(?>(?!\\brecord\\s)\\w++|[\\w\\s&&[^r]]++)*+\\brecord\\s+[\\w$])