Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile completion #826

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

ANtlord
Copy link

@ANtlord ANtlord commented Jun 26, 2020

Pull request for #823

I've done a little investigation so I can say that Completion.get_signatures() and Completion.docstring() slow down performance about 5 times. The results of the functions are not seen in completions for NeoVim/Vim at least so calling the functions is overhead for the case.

I dump time ranges in files /tmp/pyls_completions.prof for pyls_completions method and /tmp/PythonLanguageServer.completions.prof for completions method of PythonLanguageServer class.

Here are the results of the investigation:

==> pyls_completions.prof.fast <==
pyls_completions total 0:00:00.724521 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=324), 'update': datetime.timedelta(microseconds=75766), 'total': datetime.timedelta(microseconds=76090)})
pyls_completions total 0:00:00.165487 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=321), 'update': datetime.timedelta(microseconds=23167), 'total': datetime.timedelta(microseconds=23488)})
pyls_completions total 0:00:00.177044 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=297), 'update': datetime.timedelta(microseconds=23520), 'total': datetime.timedelta(microseconds=23817)})

==> pyls_completions.prof.slow <==
pyls_completions total 0:00:01.708528 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=626150), 'update': datetime.timedelta(microseconds=426714), 'total': datetime.timedelta(seconds=1, microseconds=52864)})
pyls_completions total 0:00:01.132067 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=546148), 'update': datetime.timedelta(microseconds=432481), 'total': datetime.timedelta(microseconds=978629)})
pyls_completions total 0:00:01.099432 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=535644), 'update': datetime.timedelta(microseconds=409444), 'total': datetime.timedelta(microseconds=945088)})
pyls_completions total 0:00:01.216887 format_profile_ranges defaultdict(<class 'datetime.timedelta'>, {'documentation': datetime.timedelta(microseconds=632716), 'update': datetime.timedelta(microseconds=429011), 'total': datetime.timedelta(seconds=1, microseconds=61727)})

==> PythonLanguageServer.completions.prof.fast <==
completions 0:00:00.725947
completions 0:00:00.166862
completions 0:00:00.178388

==> PythonLanguageServer.completions.prof.slow <==
completions 0:00:01.710710
completions 0:00:01.134438
completions 0:00:01.101723
completions 0:00:01.218994

The *.fast reports are done with commit a0d32bb; the *.slow reports are done with 21c484e.

The first one doesn't get signatures, documentation and labels for completions. Code in the latter commit differs from version from develop branch but does the same. As wrote the data is not required to get completions but it slows down performance 5 times after the first call. The first call is slower only 2 times because Jedi use sources instead of its internal cache. Tested script consists of import os; os..

I don't have certain suggestions. The only idea I have is introducing new settings avoids getting documentation and pretty labels.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/python-language-server, @ANtlord! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@astier
Copy link

astier commented Aug 4, 2020

You need to sign a two page long license agreement full of corporate gibberish just to make a PR? bruh...
Can I find somewhere an explanation or a statement why this is necessary? I thought pyls is MIT Licensed.

@idoktz
Copy link

idoktz commented Aug 14, 2020

Huge improvement for large projects. I hope a PR with better defaults (without docs & labels) as suggested will get merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants