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

Performance issues with code completion #2815

Closed
kaloyan-raev opened this issue Oct 18, 2016 · 7 comments · Fixed by #3146
Closed

Performance issues with code completion #2815

kaloyan-raev opened this issue Oct 18, 2016 · 7 comments · Fixed by #3146
Assignees
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Milestone

Comments

@kaloyan-raev
Copy link
Contributor

kaloyan-raev commented Oct 18, 2016

The issue from user point of view is that sometimes there is a big delay (5-10 seconds) between invoking code completion and showing the list with proposals. An acceptable delay would be less than a seconds, and if close to a second, not to have the delay on every keystroke.

After spending some time examining how code completion works both in VS Code and Eclipse Che, I can say that the performance issue in Che is not observed in VS Code using the same language server. So, we should look for optimizing the code completion mechanism on Che side rather than in the specific language servers.

Issue 1. Che floods the DOM tree with HTML elements for each completion proposal item.

It's a common case the language server to return a completion list with 5,000-10,000 items and even more. Currently, Che adds a <li> element to the completion proposal widget for each proposal item. And each <li> element includes several <span> elements for coloring. This flood to the DOM tree is the major contributor to the big delay.

Instead of this wasteful generation of thousands of HTML elements, the completion proposal widget should have a fixed number of <li> elements that cover the visible area plus some buffer above and below it. These <li> elements should be reused as the user scrolls the list up and down. I am not sure at the moment how this can be achieved with GWT, my knowledge is still pretty limited. As a low hanging fruit, we can just limit the maximum number of items displayed in the completion proposal widget to some reasonable number (e.g. 300).

Issue 2. Che does not respect the CompletionList.isIncomplete flag.

This flag tells the client if further typing would return different result. If the flag is false, i.e. the list is "complete" then the client should not send another completion request to the server, but just do additional filtering on the result from the previous request. Respecting the isIncomplete flag would avoid sending unnecessary completion requests on every key stroke.

Issue 1 is the more severe one and affects not only the code completion with language servers, but also the code completion in general, e.g. it affects the Java code completion.

@kaloyan-raev kaloyan-raev mentioned this issue Oct 18, 2016
34 tasks
@TylerJewell TylerJewell added the kind/enhancement A feature request - must adhere to the feature request template. label Oct 18, 2016
@TylerJewell
Copy link

This analysis is quite good. @bmicklea - let's assign this for M7 or M8. I think that these improvements are going to be universally felt, and I suspect that they are not extremely difficult. Is this @vparfonov or @evidolob for an initial implementation?

@TylerJewell TylerJewell added this to the 5.0.0-M7 milestone Oct 18, 2016
@bmicklea
Copy link

@vparfonov please assign this to someone for the current or next sprint.

@TylerJewell
Copy link

Maybe next sprint - certainly not this sprint. We need to think this through and look at for M7 or M8. It's a great improvement, and probably necessary to finish before 5.0 GA.

@bmicklea bmicklea modified the milestones: 5.0.0-M7, 5.0.0-M8 Oct 18, 2016
@bmicklea bmicklea removed this from the 5.0.0-M8 milestone Nov 16, 2016
@bmicklea
Copy link

@vparfonov - please add status and sprint labels

@kaloyan-raev
Copy link
Contributor Author

Just to let you know that I started working on this topic. I did some research and I have a good idea how to resolve issue 1.

@kaloyan-raev
Copy link
Contributor Author

I prepared PR #3146 to address Issue 1.

I will take care for issue 2 in another PR.

@kaloyan-raev
Copy link
Contributor Author

I have a patch for Issue 2 in the same PR #3146.

I decided to include it in the same PR, because the positive effect of fixing issue 2 is not really visible without having the fix for issue 1.

I noticed another small issue. There is some noticeable flickering of the content assist widget between keystrokes. I will work on it too. However, most of the work on this topic is done and I would appreciate some initial review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants