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

Return completions lazily for massive savings #2217

Merged
merged 1 commit into from Sep 20, 2021
Merged

Conversation

pepeiborra
Copy link
Collaborator

@pepeiborra pepeiborra commented Sep 20, 2021

This is the second completions performance issue (after #2215) uncovered by upgrading Sigma IDE from HLS 1.2 to 1.4.

The problem is that getCompletions returns the completions strictly, only to have them cropped to maxCompletions in hls-plugin-api. This is bad because there is an O(nlogn) nubOrdBy in the result thunk, and it can take a second or more to nub >100k results.

Thankfully nubOrdBy is lazy in the result so the fix is simple. By restoring result laziness in getCompletions, only up to maxCompletions results are processed by nubOrdBy.

Copy link
Member

@jneira jneira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@pepeiborra pepeiborra added the merge me Label to trigger pull request merge label Sep 20, 2021
@mergify mergify bot merged commit 86b3726 into master Sep 20, 2021
cdsmith pushed a commit to cdsmith/haskell-language-server that referenced this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants