tzachar / compe-tabnine

TabNine source for hrsh7th/nvim-compe
BSD 3-Clause "New" or "Revised" License
52 stars 3 forks source link

Input lag with tabnine source enabled #22

Closed akinsho closed 3 years ago

akinsho commented 3 years ago

When using tabnine on Linux (Ubuntu 20.10), I've noticed that whilst inserting text my cursor seems to lag behind. I've tried disabling tab nine and this seems to go away once it's disable.

The binaries available in the compe-tabnine directory are 0.0.1 3.3.115 3.3.118 3.3.120 TabNine_Linux.

tabnine_slow

Note: I use compe-tabnine on a non-lua codebase on a mac sometimes and have not noticed the same cursor delay although I'm not 100% sure if I've just overlooked it or am more aware on my linux machine.

I'm not sure what other information would be useful so please let me know if I can provide something else.

tzachar commented 3 years ago

I can't reproduce this, so try with a minial config. You can also try setting tabnine to the disbled state and see if it helps:

let g:compe.source.tabnine.disabled = v:true

In this state, the plugin will not load the tabnine binary and will not perform any other actions. If the lag persists, then this plugin is probably not the culprit...

akinsho commented 3 years ago

@tzachar I've actually had it set to disabled for a few days and have noticed the lag has stopped. I'll try seeing if I can make a minimal reproduction. One thing to note though is I usually use tmux and have about 6 instances of neovim open in different tmux windows. I'm not sure if it could be the combined effect of several tabnine processes? some lsps tend to become inactive when vim isn't focused not sure if the tabnine source stops working if not in use?

tzachar commented 3 years ago

Does the lag happen when you have a single instance of vim open?

On Sun, May 2, 2021 at 1:17 PM Akin @.***> wrote:

@tzachar https://github.com/tzachar I've actually had it set to disabled for a few days and have noticed the lag has stopped. I'll try seeing if I can make a minimal reproduction. One thing to note though is I usually use tmux and have about 6 instances of neovim open in different tmux windows. I'm not sure if it could be the combined effect of several tabnine processes? some lsps tend to become inactive when vim isn't focused not sure if the tabnine source stops working if not in use?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tzachar/compe-tabnine/issues/22#issuecomment-830784756, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFXXC5IVIRJS524FNRY37DTLURB5ANCNFSM432KC64Q .

shaunsingh commented 3 years ago

I had the same issue as well, when I use tabnine as a source neovim became quite laggy and my laptop heated up. The issue hasn't been present after removing it a few days back

tzachar commented 3 years ago

In general, TabNine tries to index your entire working directory. So, if you open vim inside a folder containing many source files, TabNine might consume a lot of your CPU. To further diagnose this, I suggest the following steps: 1) Does the lag happen when you open vim in a directory containing a single source file? 2) If you use a different completion plugin (I suggest deoplete) with TabNine support, do you still get the lag? 3) Create an artificial 100% load on your CPUs. Do you still get lag even without TabNine loaded? Make sure to also create IO load.

Would love to get answers to the above.

akinsho commented 3 years ago

@tzachar I noted this issue in projects ranging from 10 - 60 files, tbh I've been/am quite swamped atm and can't really dig in and swap out/setup a different completion framework to test for the moment. I'm conscious of just leaving this issue hanging though so if you'd prefer I can just close it, otherwise I can try to get back to providing more detail but it'll be a little while longer till things quieten down a bit for me