Bug 464603

Summary: [content assist] Consider computing AnonymousTypeCompletionProposal label lazily
Product: [Eclipse Project] JDT Reporter: Marcel Bruch <marcel.bruch>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 4.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Profiling Screenshot none

Description Marcel Bruch CLA 2015-04-14 09:33:40 EDT
Created attachment 252381 [details]
Profiling Screenshot

Profiling shows that after fixing bug 464552 the next bottleneck in creation of AnonymousTypeCompletions [1] are:

1. IJavaElement element= fJavaProject.findElement(new String(declarationKey), null) and
2. StyledString label= fLabelProvider.createAnonymousTypeLabel(proposal);


While 1. seems to be necessary on a first look (assuming that there really may be a case where the element may be null), 2. looks like a candidate for lazy initialization of the styled display string.

If changing this, using LazyJavaCompletionProposal (or a subtype of it) as superclass looks more appropriate to me.



However, the performance gain by bug 464552 is more significant. AFAICT ATM this change would be a noticeable but smaller enhancement.



[1] org.eclipse.jdt.ui.text.java.CompletionProposalCollector.createAnonymousTypeProposal(CompletionProposal, JavaContentAssistInvocationContext)