Summary: | vim-7.0_alpha20060113 100% cpu usage and hang | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Grant Goodyear (RETIRED) <g2boojum> |
Component: | Current packages | Assignee: | Vim Maintainers <vim> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | gridding.rst |
Description
Grant Goodyear (RETIRED)
![]() Created attachment 78239 [details]
gridding.rst
Okay. It doesn't actually hang. It just takes a reaaallllly long time to do the highlighting. You can see this if you move the duff - further to the left. Given long enough it'll eventually finish the syntax and resume. On column 28 it takes several seconds. On column 29 it takes tens of seconds. On column 30 it takes nearly a minute. Next step: find the regex that's causing it. syntax/rst.vim:35 That's a really nasty regex... Can get the same result via: :echo matchstr("=========== ============= =================-==============", '^\s*\%(=\+\s\+\)\%(=\+\s*\)\+$') vim6 does this too, so it's not a regression. So... We could change it to use this (icky) regex: start='^\n\%(\s*\)\@>\%(\%(=\+\)\@>\%(\s\+\)\@>\)\%(\%(\%(=\+\)\@>\%(\s*\)\@>\)\+\)\@>$' The same thing will need to be done for rstSimpleTableLines etc. too. Pretty nasty. (In reply to comment #3) > syntax/rst.vim:35 > > That's a really nasty regex... > > Can get the same result via: > > :echo matchstr("=========== ============= =================-==============", > '^\s*\%(=\+\s\+\)\%(=\+\s*\)\+$') > > vim6 does this too, so it's not a regression. > > So... We could change it to use this (icky) regex: > > start='^\n\%(\s*\)\@>\%(\%(=\+\)\@>\%(\s\+\)\@>\)\%(\%(\%(=\+\)\@>\%(\s*\)\@>\)\+\)\@>$' > > The same thing will need to be done for rstSimpleTableLines etc. too. > > Pretty nasty. Well, thanks to the wonders of backtracking NFAs, yes, my regex is very slow, and yours is of course slow as it is so complex. I was wondering if I should remove the whole table-matching syntax-code. I think it's too complex as it is, gives so-so results, and just makes tables a bit too flourescent. So, what do you say, can we just drop the /rst\(Simple\)\=Table\(Lines\)\=/? Thanks for spotting this, by the way. nikolai Hrm. In theory adding the no backtracks marks shouldn't slow things down (beyond a very slight increase in parse time). Is this not the case? If they're introducing substantial overhead we might have found a bug in the regex engine. (In reply to comment #5) > Hrm. In theory adding the no backtracks marks shouldn't slow things down > (beyond a very slight increase in parse time). Is this not the case? If they're > introducing substantial overhead we might have found a bug in the regex engine. > Oh! Of course! Sorry, I misread the regex. Still, I think that these highlightings ar too complex and add too little value to be included. What's your thoughts on that? Aww, I think they're pretty. Is this bug still a problem? I'm not able to reproduce it myself. Can't reproduce, so I'm resolving the bug. Feel free to yell at me if it's still a problem. Maybe somebody fixed this in the interim and didn't note it here? |