-
Notifications
You must be signed in to change notification settings - Fork 401
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
completion: listing constructors is slow #1836
Comments
From the responses we can see, we already defer calculation of import statements in Now the problem is, why below methods cost so much time? Are they necessary? Do we have to calculate it in |
Above line is the culprit, it formats the hard-coded body part for every completion item. E.g. When we complete for
It's combined by two parts.
The way to calculate new body is to hard-code a string I assume the original purpose was to have correct indentation and line delimiters. Formatting is expensive, and the same stuff is repeatedly calulated for all items. Attaching Call_Tree_CompleteForConstructors.zip (I remove this line and played for a while, and I didn't see any difference. But of course there must be edge cases untested) Potential solutions
|
I don't understand how option 2 works |
ok if you find an elegant way to call that part once for all items then I'm all for it |
There's a whole bunch of StringBuffers in that class, moving to StringBuilders won't hurt |
I just recall why we have that part. In the past the new body also contained unimplemented methods (removed for performance concern), and that's why we needed to format. |
Close it with PR #1854 |
CPU: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz *8 cores
OS: Windows 10
Test project: a simple maven project with no extra dependency
Use case: complete for new constructor
profiling details:
Sample response:
Because my CPU is relative powerful, 263ms is not a small number. It can be up to 1s on my other machines.
one item from completion response:
response of
resolve
request:The text was updated successfully, but these errors were encountered: