Skip to content

completion performance: calculating constantValue is expensive #1835

@testforstephen

Description

@testforstephen

When code completion suggests constant fields, it will resolve their values directly and display them in the label section. See the screenshot.

image

It turns out this is an expensive operation. Especially when a type contains many constant fields, resolving them all during code completion will significantly reduce performance. See the profiling result, resolving constant value for the fields of org.eclipse.jdt.internal.compiler.ast.ASTNode will cost 45% CPU time of the language server.

image

And if I set the CompletionHandler.completion as the call tree root, you can see that resolving constant field will cost more than 90% CPU time of the completion handler.
image

Suggestion: We can remove the constant value from the label part so as to avoid the expensive calculations. But keep its value in javadoc in case the user wants to see its value.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions