Open GoogleCodeExporter opened 9 years ago
:set lazyredraw serves as a workaround, though the underlying problem still
remains.
Original comment by nil...@gmail.com
on 13 Nov 2014 at 4:53
Looks like the syntax highlighting rules are expensive. Check the help at :h
syntime
Here is a patch, that tries to deviate the most expensive patterns on my system
(I have on around 60 lines visible (sorry no expensive monitor for me ;)) and
tuned the most expensive patterns. Check, if it works for you.
Original comment by chrisbr...@googlemail.com
on 13 Nov 2014 at 7:10
Attachments:
I applied your patch. It doesn't seem that any of the patterns you modified
appear in my top 10 slowest. The rubyConstant pattern doesn't seem to match the
one in the ruby.vim syntax file, so I'm a little confused.
Before:
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
0.017596 184 0 0.000693 0.000096 rubySymbol []})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@=
0.006892 184 0 0.000156 0.000037 rubySymbol \%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!
0.001577 188 4 0.000065 0.000008 rubyCapitalizedMethod \%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@=
0.001533 26 0 0.000109 0.000059 rubyFunction \%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=
0.001517 248 86 0.000038 0.000006 rubyConstant \%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!
0.001224 220 36 0.000028 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>
0.001180 190 6 0.000042 0.000006 rubyConditionalExpression \%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>
0.001140 184 0 0.000030 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|require_relative\|raise\|throw\|trap\|using\)\>
0.001123 184 0 0.000028 0.000006 rubyFloat \%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>
0.001099 184 0 0.000029 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>
After:
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
0.026836 278 0 0.000804 0.000097 rubySymbol []})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@=
0.010392 278 0 0.000180 0.000037 rubySymbol \%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!
0.002325 380 137 0.000038 0.000006 rubyConstant \%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!
0.002287 284 6 0.000078 0.000008 rubyCapitalizedMethod \%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@=
0.002259 39 0 0.000118 0.000058 rubyFunction \%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=
0.001899 332 54 0.000047 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>
0.001876 287 9 0.000078 0.000007 rubyConditionalExpression \%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>
0.001768 278 0 0.000031 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|require_relative\|raise\|throw\|trap\|using\)\>
0.001709 278 0 0.000037 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>
0.001693 278 0 0.000038 0.000006 rubyKeywordAsMethod \%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|refine\|rescue\|retry\|return\|self\|super\|then\|true\)\>
Original comment by nil...@gmail.com
on 13 Nov 2014 at 7:47
I am looking at the before patterns.
Your syntime doesn't look that bad. I am surprised that your vim is so slow for
you. You could try to add '\<' in front of the rubySymbol just after teh \@<!
respectively the \@<= atoms and possibly at the end before the [!?]\= atom.
Does it work better if you 'set re=1' in your .vimrc?
Since the report doesn't look that bad, perhaps you could try profiling with
the latest Vim version?
Original comment by chrisbr...@googlemail.com
on 13 Nov 2014 at 8:12
I'm afraid I don't have much more time to spend on this. I'll work around it
with lazyredraw for now.
Original comment by nil...@gmail.com
on 13 Nov 2014 at 8:48
Im just chiming in to add that I had the same or a similar issue and 'set re=1'
made a huge difference for me with VIM 7.4 on Linux.
In ruby files larger than a couple of hundred lines the processor would spike
up to 100% and stay there for a few seconds every time I navigated up or down.
After adding 'set re=1' to vimrc it still spikes up to 35% but it's no longer
noticeable within the editor.
Original comment by shara...@gmail.com
on 3 Dec 2014 at 9:42
Original issue reported on code.google.com by
nil...@gmail.com
on 13 Nov 2014 at 4:26