Description
Hello!
I have a weird issue of completion. In a simple script import os; os.
completion takes about a second or second and half. It happens only if I use the language. Other language servers for other languages work fine.
First I've done is checking speed of Jedi. It shows quite fine results. The first completion takes 0.69s the second one takes 0.12s. When I try to get completion in my editor (Neovim) it takes about every time. It looks like that cache jedi is ignored somehow or the language does something else.
The second thing I've tried is tracing of system call with strace
. I get such statistics of system calls when a cursor stands after the dot in the end of the string import os; os.
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
46.90 0.000340 0 427 read
29.10 0.000211 0 395 write
21.66 0.000157 1 85 15 stat
1.93 0.000014 0 98 88 openat
0.14 0.000001 0 10 close
0.14 0.000001 0 19 fstat
0.14 0.000001 0 9 9 ioctl
0.00 0.000000 0 18 lseek
0.00 0.000000 0 2 getdents64
------ ----------- ----------- --------- --------- ----------------
100.00 0.000725 0 1063 112 total
Total time is 0.000725s which is quite good too. The only thing I care about is number of openat
. Some process tries to open a lot of pyi
files which don't exist but I'm not sure if it the cause of the problem.
The third what I've tried is using VSCode but unfortunately I can't get how to install the language server for the editor.
Unfortunately I don't know the protocol and I can't measure response of the language server and I don't know what else I can check to find the bottle neck.
Tech info:
Python 3.8.3
Linux kernel 5.6.19-300.fc32.x86_64
OS: Fedora 32
Editor: Neovim 0.4.3
Language client: https://github.com/autozimu/LanguageClient-neovim
Jedi benchmark
import jedi
from datetime import datetime
before = datetime.now()
jedi.Script('import os; os.').complete()
after1 = datetime.now()
jedi.Script('import os; os.').complete()
after2 = datetime.now()
print(after1 - before, after2 - after1)