Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

High CPU load on bigger branch #170

Open
peaceant opened this issue Jun 13, 2018 · 5 comments
Open

High CPU load on bigger branch #170

peaceant opened this issue Jun 13, 2018 · 5 comments

Comments

@peaceant
Copy link

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
Copy link
Author

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.

@lambdalisue
Copy link
Owner

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.

@peaceant
Copy link
Author

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

@lambdalisue
Copy link
Owner

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

lambdalisue added a commit that referenced this issue Nov 10, 2018
@lambdalisue
Copy link
Owner

Sorry for late. It's under testing but could you try if #183 solves your problem? @peaceant

lambdalisue added a commit that referenced this issue Nov 11, 2018
Executing 'sleep' would invokes asynchronous code execution and some features is not
allowed to be called from statusline from Vim 8.1.0342.

Using System.Job#wait() to make process call synchronous in statusline component
would cause numerous unwilling issues like #170, #182, or "Not allowed here" message.

So this commit made statusline components make fully asynchronous to prevent calling
System.Job#wait() from statusline.

Ref:
vim-jp/issues#1185
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants