New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby syntax highlighting w/ either cursorline or relativenumber causes lag from high CPU usage #282

Open
GoogleCodeExporter opened this Issue Aug 18, 2015 · 19 comments

Comments

Projects
None yet
10 participants
@GoogleCodeExporter

GoogleCodeExporter commented Aug 18, 2015

With ruby syntax highlighting on, turning on cursorline or relativenumber 
settings causes lag due to high CPU usage when moving the cursor up and down. 
The conditions below exaggerbate the problem to help make it obvious and 
reproducible, but the same problem exists at lesser scale with smaller terminal 
sizes. This is a significant problem though, because when CPUs are otherwise 
bogged down (eg. when pair programming with someone via screen share on Google 
Hangouts), moving the cursor in a ruby file can be ridiculously slow.

What steps will reproduce the problem?
1. Temporarily rename ~/.vim/ and ~/.vimrc to ensure nothing but vanilla vim
2. Resize the terminal window so that ~100 lines are visible (normal for large 
monitors)
3. Open a ruby file with non-trivial syntax: 
https://raw.githubusercontent.com/rails/rails/f43f56e/activerecord/lib/active_re
cord/associations.rb
4. :syntax on
5. :set relativenumber
6. Hold down j or <down> for 1-2 seconds. (Ensure the system's keyboard repeat 
rate is not slow, ideally maxed)
7. Notice that CPU usage for the vim process is at 100%, accompanied by choppy 
redrawing and lag. Upon releasing the j/<down> key, buffered keypresses 
continue to move the cursor down.

What is the expected behavior?
1. With the same file open and under the same conditions, :set syntax=java
2. Notice there is no longer excessive CPU usage or any lag when moving the 
cursor up and down. The cursor stops moving immediately when the key is 
released.

---

I understand that ruby's syntax is complex and nontrivial to parse. If there's 
no clear way to reduce CPU usage for parsing ruby syntax for syntax 
highlighting, are there other ways you can think of to prevent the syntax 
highlighting from having to be recalculated when the screen is redrawn for 
relativenumber and cursorline? Can we profile and find where the problem lies?

---

I can reproduce this in Vim 7.4 on both Ubuntu and OSX:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 12 2014 20:26:50)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   
-F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native 
-mmacosx-version-min=10.10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L. -L/usr/local/lib -L/usr/local/lib 
-F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  
-lncurses -liconv -framework Cocoa   -fstack-protector  
-L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework 
Python   -lruby.2.0.0 -lobjc


AND


VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 15 2013 11:04:13)
Included patches: 1-5
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version without GUI.  Features included (+) or not (-):
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fstack-protector 
--param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security 
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include/tcl8.5  -D_REENTRANT=1 
 -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -rdynamic 
-Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -Wl,-z,relro 
-Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm 
-ldl  -L/usr/lib -llua5.1 -Wl,-E  -fstack-protector -L/usr/local/lib  
-L/usr/lib/perl/5.14/CORE -lperl -ldl -lm -lpthread -lcrypt 
-L/usr/lib/python2.7/config-x86_64-linux-gnu

Original issue reported on code.google.com by nil...@gmail.com on 13 Nov 2014 at 4:26

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Aug 18, 2015

: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

GoogleCodeExporter commented Aug 18, 2015

: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

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Aug 18, 2015

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

  • Added labels: Runtime

Attachments:

GoogleCodeExporter commented Aug 18, 2015

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

  • Added labels: Runtime

Attachments:

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Aug 18, 2015

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

GoogleCodeExporter commented Aug 18, 2015

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

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Aug 18, 2015

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

GoogleCodeExporter commented Aug 18, 2015

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

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Aug 18, 2015

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

GoogleCodeExporter commented Aug 18, 2015

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

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Aug 18, 2015

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

GoogleCodeExporter commented Aug 18, 2015

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

@joepestro

This comment has been minimized.

Show comment
Hide comment
@joepestro

joepestro Sep 16, 2015

Thank you for this! set re=1 made set cursorline usable for me as well (VIM 7.4 on OSX).

joepestro commented Sep 16, 2015

Thank you for this! set re=1 made set cursorline usable for me as well (VIM 7.4 on OSX).

@chrisbra

This comment has been minimized.

Show comment
Hide comment
@chrisbra

chrisbra Sep 16, 2015

Member

Issue is in the runtime files: So please report there: vim-ruby/vim-ruby#243

Member

chrisbra commented Sep 16, 2015

Issue is in the runtime files: So please report there: vim-ruby/vim-ruby#243

larrylv added a commit to larrylv/dotfiles that referenced this issue Oct 10, 2015

usommerl pushed a commit to usommerl/configuration-vim that referenced this issue Oct 29, 2015

rdlugosz added a commit to rdlugosz/dotfiles that referenced this issue Nov 2, 2015

Disable relativenumber on MacVim
This makes redraws in MacVim (on Ruby files, mostly (only?)) rather
slow. Discussed in this issue: vim/vim#282
@nicklozon

This comment has been minimized.

Show comment
Hide comment
@nicklozon

nicklozon Dec 8, 2015

Same happens with PHP syntax highlighting, as well as others.

Improving regex strings will help alleviate the lag, but the core problem still exists where the relativenumber option causes the regex to execute too often while holding down a cursor movement key.

Edit: lazyredraw/ttyfast doesn't solve the issue since it is the syntax regex causing the CPU lag.

nicklozon commented Dec 8, 2015

Same happens with PHP syntax highlighting, as well as others.

Improving regex strings will help alleviate the lag, but the core problem still exists where the relativenumber option causes the regex to execute too often while holding down a cursor movement key.

Edit: lazyredraw/ttyfast doesn't solve the issue since it is the syntax regex causing the CPU lag.

@chrisbra

This comment has been minimized.

Show comment
Hide comment
@chrisbra

chrisbra Dec 8, 2015

Member

Use the syntime command to find specific syntax patterns that are slow. We can then hopefully improve that performance.

Member

chrisbra commented Dec 8, 2015

Use the syntime command to find specific syntax patterns that are slow. We can then hopefully improve that performance.

@brammool

This comment has been minimized.

Show comment
Hide comment
@brammool

brammool Dec 11, 2015

Contributor

Christian Brabandt wrote:

Use the syntime command to find specific syntax patterns that are
slow. We can then hopefully improve that performance.

When moving the cursor around, with 'relativenumber' or 'cursorcolumn'
set, cause a full redraw, because every line changes. I'm wondering if
it is possible to cache the result of syntax highlighting. It would
require storing the "attr" value, before it's mixed with other
attributes, such as from 'cursorcolumn'. So long as we don't scroll the
screen update would be much faster. These days memory is plenty, thus
that isn't a problem.

As soon as you page forward it's just as slow, of course, thus making
the syntax highlighting faster is still desired.

Google is kind of like Dr. Who's Tardis; it's weirder on the
inside than on the outside...

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \
\ an exciting new programming language -- http://www.Zimbu.org ///
\ help me help AIDS victims -- http://ICCF-Holland.org ///

Contributor

brammool commented Dec 11, 2015

Christian Brabandt wrote:

Use the syntime command to find specific syntax patterns that are
slow. We can then hopefully improve that performance.

When moving the cursor around, with 'relativenumber' or 'cursorcolumn'
set, cause a full redraw, because every line changes. I'm wondering if
it is possible to cache the result of syntax highlighting. It would
require storing the "attr" value, before it's mixed with other
attributes, such as from 'cursorcolumn'. So long as we don't scroll the
screen update would be much faster. These days memory is plenty, thus
that isn't a problem.

As soon as you page forward it's just as slow, of course, thus making
the syntax highlighting faster is still desired.

Google is kind of like Dr. Who's Tardis; it's weirder on the
inside than on the outside...

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \
\ an exciting new programming language -- http://www.Zimbu.org ///
\ help me help AIDS victims -- http://ICCF-Holland.org ///

@gpakosz

This comment has been minimized.

Show comment
Hide comment
@gpakosz

gpakosz Jan 7, 2016

I have lazyredraw enabled and regexpengine set to 0.

In my case, it's foldmethod=syntax being responsible for the lag

  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN
4.496335   17040  104     0.021650    0.000264  rubyConditionalExpression \%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(\\\n\s*\)\@<!

Forcing set regexpengine=1 doesn't improve the situation.

gpakosz commented Jan 7, 2016

I have lazyredraw enabled and regexpengine set to 0.

In my case, it's foldmethod=syntax being responsible for the lag

  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN
4.496335   17040  104     0.021650    0.000264  rubyConditionalExpression \%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(\\\n\s*\)\@<!

Forcing set regexpengine=1 doesn't improve the situation.

@vim-ml

This comment has been minimized.

Show comment
Hide comment
@vim-ml

vim-ml Jan 8, 2016

2016-01-08 2:12 GMT+03:00 Gregory Pakosz vim-dev-github@256bit.org:

I have lazyredraw enabled and regexpengine set to 0.

In my case, it's foldmethod=syntax being responsible for the lag

TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
4.496335 17040 104 0.021650 0.000264 rubyConditionalExpression %(%(^|...=|[{:,;([<>~%&^|+=-]|%(<[[:lower:]][[:alnum:]])@<![?!])\s)@<=%(\n\s)@<!

Forcing set regexpengine=1 doesn't improve the situation.

​I see this pattern having quite a large number of look-behinds. Forcing
maximum amount of bytes here may help (search for \@123<= in :h ​/\@<=,
for some reason this does not have its own tag). Contacting syntax file
maintainer is needed to perform this change, I am not sure what numbers you
should exactly place there.

Most likely using @100<! in place of @<! (two occurences) and @100<=
(one I see so far) should work fine.


Reply to this email directly or view it on GitHub
#282 (comment).

You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to vim_dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vim-ml commented Jan 8, 2016

2016-01-08 2:12 GMT+03:00 Gregory Pakosz vim-dev-github@256bit.org:

I have lazyredraw enabled and regexpengine set to 0.

In my case, it's foldmethod=syntax being responsible for the lag

TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
4.496335 17040 104 0.021650 0.000264 rubyConditionalExpression %(%(^|...=|[{:,;([<>~%&^|+=-]|%(<[[:lower:]][[:alnum:]])@<![?!])\s)@<=%(\n\s)@<!

Forcing set regexpengine=1 doesn't improve the situation.

​I see this pattern having quite a large number of look-behinds. Forcing
maximum amount of bytes here may help (search for \@123<= in :h ​/\@<=,
for some reason this does not have its own tag). Contacting syntax file
maintainer is needed to perform this change, I am not sure what numbers you
should exactly place there.

Most likely using @100<! in place of @<! (two occurences) and @100<=
(one I see so far) should work fine.


Reply to this email directly or view it on GitHub
#282 (comment).

You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to vim_dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

@chrisbra

This comment has been minimized.

Show comment
Hide comment
@chrisbra

chrisbra Jan 8, 2016

Member

You should mentioned this here: vim-ruby/vim-ruby#243

Member

chrisbra commented Jan 8, 2016

You should mentioned this here: vim-ruby/vim-ruby#243

@Lynesth

This comment has been minimized.

Show comment
Hide comment
@Lynesth

Lynesth Mar 25, 2016

Hey there,

I'm having the same issue using php files (even with small ones, ~120 lines, 4kB). I don't know about ruby files since I don't work with those but everything else I use (html, css, javascript) is ok. Problem didn't exist in 7.3.

Removing either syntax highlighting or cursorline (and relativenumber, but I don't use it) solves the issue, but I can't live without any of those ^^

I noticed after a few checks that removing HereDoc/NowDoc regex makes everything smooth again.
I just don't know how to do it properly so I edited the original php.vim file.

In case you wanted some informations:

  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN
  0.225932   8239   0       0.000081    0.000027  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\(\I\i*\
  0.223937   8239   0       0.000079    0.000027  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\(\I\i*\
  0.220748   8239   0       0.000102    0.000027  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\(\I\i*\
  0.200274   8239   0       0.000076    0.000024  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\I\i*\)\
  0.093085   8239   0       0.000036    0.000011  phpFloat           \(-\=\<\d+\|-\=\)\.\d\+\>
  0.088690   40927  35269   0.000012    0.000002  phpParent          [({[\]})]
  0.063615   17808  10185   0.000024    0.000004  phpOperator        [-=+%^&|*!.~?:]
  0.052475   8485   246     0.000025    0.000006  phpOperator        [-+*/%^&|.]=
  0.047634   16258  8266    0.000014    0.000003  phpNumber          -\=\<\d\+\>
  0.045641   9500   1262    0.000014    0.000005  phpComparison      \v[=<>-]@<![<>]\=?[<>]@!
  0.040510   8239   0       0.000031    0.000005  phpNowDoc          \(<<<\)\@<='\z(\(\I\i*\)\=\(ja
  0.039808   8977   738     0.000016    0.000004  phpOperator        ||\|\<x\=or\>
  0.038677   8239   0       0.000030    0.000005  phpNowDoc          \(<<<\)\@<='\z(\(\I\i*\)\=\(sq
  0.037592   8239   0       0.000029    0.000005  phpNowDoc          \(<<<\)\@<='\z(\(\I\i*\)\=\(ht
  0.035145   8239   0       0.000018    0.000004  phpOperator        &&\|\<and\>
  0.032899   8239   0       0.000019    0.000004  phpNowDoc          \(<<<\)\@<='\z(\I\i*\)'$
  0.030615   8368   129     0.000013    0.000004  phpRelation        [!=<>]=
  0.025588   8755   516     0.000011    0.000003  phpComparison      \v[=!]\=\=?
  0.024676   8365   127     0.000011    0.000003  phpRelation        [<>]
  0.022235   23519  15896   0.000007    0.000001  phpIdentifier      $\h\w*
  0.020534   8239   615     0.000046    0.000002  phpComment         //.\{-}\(?>\|$\)\@=
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:36:03)
Included patches: 1-488, 576
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by jamessan@debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             -ebcdic          +localmap        +printer         +title
+arabic          +emacs_tags      -lua             +profile         -toolbar
+autocmd         +eval            +menu            -python          +user_commands
-balloon_eval    +ex_extra        +mksession       -python3         +vertsplit
-browse          +extra_search    +modify_fname    +quickfix        +virtualedit
++builtin_terms  +farsi           +mouse           +reltime         +visual
+byte_offset     +file_in_path    -mouseshape      +rightleft       +visualextra
+cindent         +find_in_path    +mouse_dec       -ruby            +viminfo
-clientserver    +float           +mouse_gpm       +scrollbind      +vreplace
-clipboard       +folding         -mouse_jsbterm   +signs           +wildignore
+cmdline_compl   -footer          +mouse_netterm   +smartindent     +wildmenu
+cmdline_hist    +fork()          +mouse_sgr       -sniff           +windows
+cmdline_info    +gettext         -mouse_sysmouse  +startuptime     +writebackup
+comments        -hangul_input    +mouse_urxvt     +statusline      -X11
+conceal         +iconv           +mouse_xterm     -sun_workshop    -xfontset
+cryptv          +insert_expand   +multi_byte      +syntax          -xim
+cscope          +jumplist        +multi_lang      +tag_binary      -xsmp
+cursorbind      +keymap          -mzscheme        +tag_old_static  -xterm_clipboard
+cursorshape     +langmap         +netbeans_intg   -tag_any_white   -xterm_save
+dialog_con      +libcall         +path_extra      -tcl             -xpm
+diff            +linebreak       -perl            +terminfo
+digraphs        +lispindent      +persistent_undo +termresponse
-dnd             +listcmds        +postscript      +textobjects
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fPIE -fstack-protector-strong -Wformat -
Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -
lselinux -lacl -lattr -lgpm -ldl

I didn't know if I had to start an new issue for that, sorry if it was the case.

Kind regards,

Lyn.

Lynesth commented Mar 25, 2016

Hey there,

I'm having the same issue using php files (even with small ones, ~120 lines, 4kB). I don't know about ruby files since I don't work with those but everything else I use (html, css, javascript) is ok. Problem didn't exist in 7.3.

Removing either syntax highlighting or cursorline (and relativenumber, but I don't use it) solves the issue, but I can't live without any of those ^^

I noticed after a few checks that removing HereDoc/NowDoc regex makes everything smooth again.
I just don't know how to do it properly so I edited the original php.vim file.

In case you wanted some informations:

  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN
  0.225932   8239   0       0.000081    0.000027  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\(\I\i*\
  0.223937   8239   0       0.000079    0.000027  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\(\I\i*\
  0.220748   8239   0       0.000102    0.000027  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\(\I\i*\
  0.200274   8239   0       0.000076    0.000024  phpHereDoc         \(<<<\)\@<=\(\"\=\)\z(\I\i*\)\
  0.093085   8239   0       0.000036    0.000011  phpFloat           \(-\=\<\d+\|-\=\)\.\d\+\>
  0.088690   40927  35269   0.000012    0.000002  phpParent          [({[\]})]
  0.063615   17808  10185   0.000024    0.000004  phpOperator        [-=+%^&|*!.~?:]
  0.052475   8485   246     0.000025    0.000006  phpOperator        [-+*/%^&|.]=
  0.047634   16258  8266    0.000014    0.000003  phpNumber          -\=\<\d\+\>
  0.045641   9500   1262    0.000014    0.000005  phpComparison      \v[=<>-]@<![<>]\=?[<>]@!
  0.040510   8239   0       0.000031    0.000005  phpNowDoc          \(<<<\)\@<='\z(\(\I\i*\)\=\(ja
  0.039808   8977   738     0.000016    0.000004  phpOperator        ||\|\<x\=or\>
  0.038677   8239   0       0.000030    0.000005  phpNowDoc          \(<<<\)\@<='\z(\(\I\i*\)\=\(sq
  0.037592   8239   0       0.000029    0.000005  phpNowDoc          \(<<<\)\@<='\z(\(\I\i*\)\=\(ht
  0.035145   8239   0       0.000018    0.000004  phpOperator        &&\|\<and\>
  0.032899   8239   0       0.000019    0.000004  phpNowDoc          \(<<<\)\@<='\z(\I\i*\)'$
  0.030615   8368   129     0.000013    0.000004  phpRelation        [!=<>]=
  0.025588   8755   516     0.000011    0.000003  phpComparison      \v[=!]\=\=?
  0.024676   8365   127     0.000011    0.000003  phpRelation        [<>]
  0.022235   23519  15896   0.000007    0.000001  phpIdentifier      $\h\w*
  0.020534   8239   615     0.000046    0.000002  phpComment         //.\{-}\(?>\|$\)\@=
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:36:03)
Included patches: 1-488, 576
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by jamessan@debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             -ebcdic          +localmap        +printer         +title
+arabic          +emacs_tags      -lua             +profile         -toolbar
+autocmd         +eval            +menu            -python          +user_commands
-balloon_eval    +ex_extra        +mksession       -python3         +vertsplit
-browse          +extra_search    +modify_fname    +quickfix        +virtualedit
++builtin_terms  +farsi           +mouse           +reltime         +visual
+byte_offset     +file_in_path    -mouseshape      +rightleft       +visualextra
+cindent         +find_in_path    +mouse_dec       -ruby            +viminfo
-clientserver    +float           +mouse_gpm       +scrollbind      +vreplace
-clipboard       +folding         -mouse_jsbterm   +signs           +wildignore
+cmdline_compl   -footer          +mouse_netterm   +smartindent     +wildmenu
+cmdline_hist    +fork()          +mouse_sgr       -sniff           +windows
+cmdline_info    +gettext         -mouse_sysmouse  +startuptime     +writebackup
+comments        -hangul_input    +mouse_urxvt     +statusline      -X11
+conceal         +iconv           +mouse_xterm     -sun_workshop    -xfontset
+cryptv          +insert_expand   +multi_byte      +syntax          -xim
+cscope          +jumplist        +multi_lang      +tag_binary      -xsmp
+cursorbind      +keymap          -mzscheme        +tag_old_static  -xterm_clipboard
+cursorshape     +langmap         +netbeans_intg   -tag_any_white   -xterm_save
+dialog_con      +libcall         +path_extra      -tcl             -xpm
+diff            +linebreak       -perl            +terminfo
+digraphs        +lispindent      +persistent_undo +termresponse
-dnd             +listcmds        +postscript      +textobjects
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fPIE -fstack-protector-strong -Wformat -
Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -
lselinux -lacl -lattr -lgpm -ldl

I didn't know if I had to start an new issue for that, sorry if it was the case.

Kind regards,

Lyn.

@chrisbra

This comment has been minimized.

Show comment
Hide comment
@chrisbra

chrisbra Mar 25, 2016

Member

@Lynesth try to contact the php syntax file maintainer. perhaps he can come up with a better syntax RE for the phpHereDoc item.

Member

chrisbra commented Mar 25, 2016

@Lynesth try to contact the php syntax file maintainer. perhaps he can come up with a better syntax RE for the phpHereDoc item.

@bluz71

This comment has been minimized.

Show comment
Hide comment
@bluz71

bluz71 May 28, 2017

@brammool

When moving the cursor around, with 'relativenumber' or 'cursorcolumn'
set, cause a full redraw, because every line changes. I'm wondering if
it is possible to cache the result of syntax highlighting. It would
require storing the "attr" value, before it's mixed with other
attributes, such as from 'cursorcolumn'. So long as we don't scroll the
screen update would be much faster. These days memory is plenty, thus
that isn't a problem.

Yes please to the power of 1 million. I would be willing to trade memory for superior scroll performance any day, every day.

Ruby files with relativenumber set along with regexpengine=0 or 2 results in terrible performance. PHP may have the same issue.

Caching syntax highlighting would be extremely beneficial especially since many Vim users enable relativenumber these days.

bluz71 commented May 28, 2017

@brammool

When moving the cursor around, with 'relativenumber' or 'cursorcolumn'
set, cause a full redraw, because every line changes. I'm wondering if
it is possible to cache the result of syntax highlighting. It would
require storing the "attr" value, before it's mixed with other
attributes, such as from 'cursorcolumn'. So long as we don't scroll the
screen update would be much faster. These days memory is plenty, thus
that isn't a problem.

Yes please to the power of 1 million. I would be willing to trade memory for superior scroll performance any day, every day.

Ruby files with relativenumber set along with regexpengine=0 or 2 results in terrible performance. PHP may have the same issue.

Caching syntax highlighting would be extremely beneficial especially since many Vim users enable relativenumber these days.

bluz71 added a commit to bluz71/dotfiles that referenced this issue May 28, 2017

Ruby performance is terrible with regexpengine=2, force regexpengine=1.
See these two issues:
  vim/vim#282
  vim-ruby/vim-ruby#243

Ruby syntax highlighting performance is much MUCH worse the new Vim
regexpengine, hence force old engine until a fix is forthcoming (if
ever).

mrhead added a commit to mrhead/dotfiles that referenced this issue Jan 30, 2018

Disable relativenumber
It is so slow in combination with vim-ruby that I want to kill myself
when I'm working with ruby files.

:(

References:

- vim-ruby/vim-ruby#243
- vim/vim#282

michelesr added a commit to michelesr/nvim-config that referenced this issue Jun 10, 2018

vide added a commit to vide/dotfiles that referenced this issue Jul 18, 2018

@vide

This comment has been minimized.

Show comment
Hide comment
@vide

vide Jul 18, 2018

This is happening to me as well but with YAML syntax highlighting. Having either relativenumber or cursorline enabled (or both) make scrolling sluggish and unusable.

Using Ubuntu 18.04 and vim inside tmux but launching it inside a plain xterm doesn't make a difference

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with X11-Athena GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    +tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua               +ruby              +X11
+dialog_con_gui    +menu              +scrollbind        +xfontset
+diff              +mksession         +signs             +xim
+digraphs          +modify_fname      +smartindent       +xpm
-dnd               +mouse             +startuptime       +xsmp_interact
-ebcdic            +mouseshape        +statusline        +xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_ATHENA   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-NQEcoP/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lXaw -lXmu -lXext -lXt -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -ldl  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm

vide commented Jul 18, 2018

This is happening to me as well but with YAML syntax highlighting. Having either relativenumber or cursorline enabled (or both) make scrolling sluggish and unusable.

Using Ubuntu 18.04 and vim inside tmux but launching it inside a plain xterm doesn't make a difference

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with X11-Athena GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    +tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua               +ruby              +X11
+dialog_con_gui    +menu              +scrollbind        +xfontset
+diff              +mksession         +signs             +xim
+digraphs          +modify_fname      +smartindent       +xpm
-dnd               +mouse             +startuptime       +xsmp_interact
-ebcdic            +mouseshape        +statusline        +xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_ATHENA   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-NQEcoP/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lXaw -lXmu -lXext -lXt -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -ldl  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm
@bluz71

This comment has been minimized.

Show comment
Hide comment
@bluz71

bluz71 commented Jul 23, 2018

Known, see these issues:

Vim #1735, Feature Request: cache syntax highlighting to improve 'relativenumber' scroll performance

Neovim #6960, api/ui: externalize 'relativenumber'

Please thumb-up those issues, with luck one day this issue will be corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment