vim-gina icon indicating copy to clipboard operation
vim-gina copied to clipboard

High CPU load on bigger branch

Open peaceant opened this issue 7 years ago • 5 comments

When I open Neovim (version 0.3.0 without any session or any file) on repository folder with branch checked (with 145 commits ahead of master) the CPU load of nvim instance goes to 57 - 60% and stays there. Is gina.vim doing any computation in background that could cause this?

Uninstalling gina solved CPU load problem or switching branch to master. I have latest macOS and I'm not doing anything special in my nvim config with gina:

Plug 'lambdalisue/gina.vim'

set statusline=%(\ %m%r%h%w%)\ %t\ %7l,%02c\ %=\ %#error#%{&paste?'\ [paste]\ ':''}%*\ [%{&ff}]\ %y\ %{gina#component#repo#preset()}\ 

" -- Git G -- {{{2
nnoremap <space>gs :Gina status --short<cr>
nnoremap <space>gr :Gbranch<cr>
nnoremap <space>gb :Gina blame<cr>
nnoremap <space>gc :Gina commit -v<cr>
nnoremap <space>gl :Gina log<cr>
nnoremap <space>gm :Gina compare<cr><C-w>L
nnoremap <space>gp :Gina push
nnoremap <space>gd :Gina diff<cr>
" Echo chunk info with j/k in blame window
call gina#custom#mapping#nmap('blame', 'j', 'j<Plug>(gina-blame-echo)')
call gina#custom#mapping#nmap('blame', 'k', 'k<Plug>(gina-blame-echo)')
" show commit preview
call gina#custom#mapping#nmap('blame', 'o', ':<C-u>call gina#action#call("show:commit:preview:bottom")<CR>', {'noremap': 1, 'silent': 1})
call gina#custom#mapping#nmap('log', 'o', ':<C-u>call gina#action#call("show:commit:preview:bottom")<CR><c-w>H', {'noremap': 1, 'silent': 1})
" diff on file
call gina#custom#mapping#nmap('status', 'o', ':<C-u>call gina#action#call("diff:preview:bottom")<CR><c-w>H', {'noremap': 1, 'silent': 1})
call gina#custom#mapping#nmap('status', '<cr>', ':<C-u>call gina#action#call("edit")<CR>', {'noremap': 1, 'silent': 1})
" }}}

peaceant avatar Jun 13 '18 06:06 peaceant

OK, I found the issue. It is in statusline. When I comment out statusline the CPU load goes to zero. If you think there's no way of optimizing %{gina#component#repo#preset()} then close this issue.

peaceant avatar Jun 13 '18 07:06 peaceant

Thanks for the investigation. Could you check which one causes the issue

  1. gina#component#repo#name()
  2. gina#component#repo#branch()
  3. gina#component#repo#track()

I guess the last one.

lambdalisue avatar Jun 13 '18 11:06 lambdalisue

Yes, the last one: gina#component#repo#track().

peaceant avatar Jun 13 '18 11:06 peaceant

Thanks. I'll consider to make it fully async.

lambdalisue avatar Jun 13 '18 11:06 lambdalisue

Sorry for late. It's under testing but could you try if https://github.com/lambdalisue/gina.vim/pull/183 solves your problem? @peaceant

lambdalisue avatar Nov 10 '18 17:11 lambdalisue