Skip to content
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

buffers cycle and flicker for ages when changing buffers after longer period of use #2502

Open
ferdinandyb opened this issue Jan 13, 2022 · 4 comments

Comments

@ferdinandyb
Copy link

environment

  • vim: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 28 2021 11:18:09) Included patches: 1-3458
  • vim-airline: commit 95935e6
  • OS: Ubuntu 20.04
  • Have you reproduced with a minimal vimrc: no (please see below)

if you are using terminal:

  • terminal: kitty
  • $TERM variable: tmux-256color
  • color configuration (:set t_Co?): t_Co=256

airline config:

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'

let g:airline_theme = 'dracula'
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1

let g:airline_left_sep = ''
let g:airline_right_sep = ''

let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline_detect_spell=1
let g:airline_detect_spelllang=1

actual behavior

It is very hard to pin down as it doesn't happen on a clean startup, I have to work for a while (this is why I haven't yet tested with a minimal vimrc). But after a while doing a simple :b# will take ages, as if airline were cycling through the buffers a million times before arriving. When I got tothis stage again I used the info here: https://stackoverflow.com/questions/12213597/how-to-see-which-plugins-are-making-vim-slow/12216578#12216578 to profile what is happening in a single :b#. It took around 2 seconds to change a buffer.

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
   56   1.136993   0.002216  <SNR>160_update_tabline()
   50   1.130876             airline#extensions#tabline#redraw()
   51   1.024465   0.001870  airline#extensions#tabline#get()
   51   1.022595   0.007055  airline#extensions#tabline#buffers#get()
   50   0.805482   0.023520  39()
 2328   0.672557   0.219378  airline#highlighter#get_highlight()
  108   0.587824   0.066941  32()
  491   0.487291   0.019835  <SNR>150_exec_separator()
 9312   0.439421             <SNR>150_get_syn()
  533   0.356166   0.007080  <SNR>178_get_seperator()
  323   0.332874   0.009973  <SNR>178_get_transitioned_seperator()
  323   0.322901   0.004246  airline#highlighter#add_separator()
   19   0.316706   0.004533  airline#check_mode()
    6   0.301689   0.029239  airline#highlighter#highlight()
  596   0.299031   0.063959  airline#highlighter#exec()
  982   0.279294   0.008188  airline#themes#get_highlight()
 1727   0.218703   0.011686  airline#builder#should_change_group()
  812   0.192971   0.118020  airline#extensions#tabline#buflist#list()
  762   0.178108   0.013853  airline#extensions#tabline#get_buffer_name()
  410   0.176298   0.014550  38()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
   50              1.130876  airline#extensions#tabline#redraw()
 9312              0.439421  <SNR>150_get_syn()
 2328   0.672557   0.219378  airline#highlighter#get_highlight()
  812   0.192971   0.118020  airline#extensions#tabline#buflist#list()
  781   0.100929   0.095990  WebDevIconsGetFileTypeSymbol()
  108   0.587824   0.066941  32()
  596   0.299031   0.063959  airline#highlighter#exec()
 3223              0.056121  airline#util#ignore_buf()
  762   0.050749   0.035512  airline#extensions#tabline#formatters#default#format()
    6   0.301689   0.029239  airline#highlighter#highlight()
  610   0.122509   0.026351  <SNR>216_evaluate_tabline()
  596              0.024983  <SNR>150_hl_group_exists()
    9   0.026375   0.024879  <SNR>191_GetNearbyTag()
  749              0.024444  <SNR>178_get_accented_line()
   50   0.805482   0.023520  39()
 1230              0.022092  airline#extensions#tabline#group_of_bufnr()
 3150              0.020922  <SNR>217_ExcludeOther()
  491   0.487291   0.019835  <SNR>150_exec_separator()
  596              0.015655  <SNR>150_CheckDefined()
  762              0.015237  airline#extensions#tabline#formatters#default#wrap_name()

Could be related to #2435

expected behavior

Buffer switching is instantaneous.

screen shot (if possible)

This is from an earlier happening but you can see the idea:

Kazam_screencast_00001.mp4
@chrisbra
Copy link
Member

Hm

50 1.130876 airline#extensions#tabline#redraw()

This is basically just :redrawtabline. Looks like this is an expansive internal vim call :(

9312 0.439421 150_get_syn()

This is expected to be expansive. Also an internal vim command. I have always wanted to profile Vim to find out what is so expansive and how to fix it, but haven't come to that yet :(

In any case, since you seem to be using a quit recent Vim version, try enabling the Vim9 Script version:

:let g:airline_experimental=1

That might considerably improve the speed of VimScript.

@ferdinandyb
Copy link
Author

Thanks for checking! I'll try the experimental setting and see. What I find strange is the amount of calls made, or is that normal? 56 calls for a single buffer switch? Also it seems to me that sometimes one way is ok, then going back is slow.

@chrisbra
Copy link
Member

note sure. In general evaluation of the statusline will happen very often, for the tabline it may not be that often the case. In that case you may try to simply change the following line:

function! airline#extensions#tabline#redraw()

and simply return as the first statement.

@KiLLeRRaT
Copy link

Are any of you using mkview and loadview? I found that as soon as I turn on loadview this flashing happens. If I leave it turned off, it's perfect.

I really do want to keep using mkview and loadview though, it's super handy in keeping my position in files, and it remembers my folds and such.

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants