question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jedi-vim causes lag in insert mode

See original GitHub issue

I’m experiencing an irritating lag in insert mode, i.e. it takes a long (up to 0.5 seconds) time for a character to appear after I type it. One of the files I’m having this issue with is ~800 lines of code, so I wouldn’t expect mere size to be the root cause? Removing jedi-vim also removes the lag, so I assume it must have something to do with this plugin. Completely removing my .vimrc doesn’t seem to have any effect. This happens with supertab, autocomplpop, and also when both of them are disabled.

I profiled some of the insert-mode madness like this:

:profile start profile.log
:profile func *
:profile file *
" At this point do slow actions
:profile pause
:noautocmd qall!

and it seems like _vim_exception is being called rather often (given that I only inserted ~80 chars):

FUNCTION  jedi#_vim_exceptions()
Called 313 times
Total time:   0.014491
 Self time:   0.014491

count  total (s)   self (s)
  313              0.002117     let l:result = {}
  313              0.000798     try
  313              0.000745         if a:is_eval
  261              0.002488             let l:result.result = eval(a:str)
  261              0.000370         else
   52              0.002304             execute a:str
   52              0.000199             let l:result.result = ''
   52              0.000060         endif
  313              0.000390     catch
                                    let l:result.exception = v:exception
                                    let l:result.throwpoint = v:throwpoint
                                endtry
  313              0.000692     return l:result

Perhaps this is an issue with vim-jedi interacting with one of my other plugins, so here’s the global summary:

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
    1   0.238969   0.000101  <SNR>20_UpdateErrors()
    1   0.231162   0.000322  <SNR>20_CacheErrors()
    2   0.229969   0.000126  SyntaxCheckers_python_GetLocList()
    2   0.229843   0.000092  SyntasticMake()
    2   0.229751   0.011751  SyntasticLocalMake()
    3   0.053375   0.052994  <SNR>39_RunPyflakes()
    1   0.019087             GetPythonIndent()
  313   0.014491             jedi#_vim_exceptions()
    4   0.012549   0.000207  <SNR>20_OSSupportsShellpipeHack()
    2   0.012342   0.000284  <SNR>20_uname()
   56   0.008552             <SNR>25_Highlight_Matching_Pair()
    1   0.007604   0.000098  <SNR>20_RedrawErrors()
    1   0.005281   0.000056  <SNR>20_RefreshSigns()
    1   0.005174   0.005001  <SNR>20_SignErrors()
    1   0.001678   0.000034  <SNR>20_AutoToggleLocList()
    1   0.001599   0.000316  <SNR>20_ShowLocList()
    1   0.000686   0.000206  SyntasticCheckable()
    1   0.000568   0.000492  <SNR>11_LoadFTPlugin()
    1   0.000495   0.000329  <SNR>5_SynSet()
    5   0.000444   0.000387  <SNR>20_FilterLocList()
FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
    3   0.053375   0.052994  <SNR>39_RunPyflakes()
    1              0.019087  GetPythonIndent()
  313              0.014491  jedi#_vim_exceptions()
    2   0.229751   0.011751  SyntasticLocalMake()
   56              0.008552  <SNR>25_Highlight_Matching_Pair()
    1   0.005174   0.005001  <SNR>20_SignErrors()
    1   0.000568   0.000492  <SNR>11_LoadFTPlugin()
    5   0.000444   0.000387  <SNR>20_FilterLocList()
    1   0.000495   0.000329  <SNR>5_SynSet()
    1   0.231162   0.000322  <SNR>20_CacheErrors()
    1   0.001599   0.000316  <SNR>20_ShowLocList()
    2   0.012342   0.000284  <SNR>20_uname()
    3              0.000239  <SNR>39_ActivatePyflakesQuickFixWindow()
    1   0.000279   0.000236  <SNR>20_HightlightErrors()
    1              0.000231  <SNR>15_addtomrufs()
    3              0.000216  SyntasticAddToErrors()
    4   0.012549   0.000207  <SNR>20_OSSupportsShellpipeHack()
    1   0.000686   0.000206  SyntasticCheckable()
   13              0.000159  <SNR>20_LocList()
    1   0.000233   0.000147  <SNR>20_LoadChecker()

Any idea where to look or how to debug this?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:27 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
balta2arcommented, Dec 11, 2015

Answering my own question, looks like this worked for me:

autocmd FileType python call jedi#configure_call_signatures()
0reactions
naggiecommented, Jul 31, 2017

This also worked for me. I am using supertab – when generating the completion menu it used to pause for seconds at at time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jedi-Vim Lags horribly! : r/vim
I am using Jedi-Vim and it lags for multiple seconds. For example: import pandas as pd import numpy as np df = pd.DataFrame(np.random.random([3,...
Read more >
Vim: insert mode is very slow with 400+ lines
When I edit it somewhere near the top (say, on line 20), Vim is snappy as always. However, editing it near the bottom...
Read more >
jedi-vim
After that the results should be cached and very fast. 2. If it is still slow after the initial completion and you have...
Read more >
Neovim 0.5 is overpowering
I noticed that I use the visual mode of vim a lot. With easy motion to highlight words or other object boundaries to...
Read more >
SpaceVim/SpaceVim
cache/vimfiles/repos/github.com/davidhalter/jedi-vim/pythonx/jedi_vim.py", line 11, in <module> from shlex import split as shsplit File "/usr/local/Cellar/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found