Bug 126277 - getAdditionalProposalInfo() slow if used from CompletionProposalCollector
Summary: getAdditionalProposalInfo() slow if used from CompletionProposalCollector
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 124483 131608
  Show dependency tree
 
Reported: 2006-02-02 16:50 EST by Phillip Avery CLA
Modified: 2006-08-14 03:47 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phillip Avery CLA 2006-02-02 16:50:19 EST
In WTP we use CompletionProposalCollector to convert Java proposals to JSP proposals.  When calling CompetionProposal#getAdditionalProposalInfo() (in LazyJavaCompletionProposal), it looks like an HTTP connection is being opened for each proposal.  This slows our content assist tremendously, and blocks the UI while collecting (and converting our proposals from Java > JSP, ~10 second hang)

I tracked it down to JavadocContentAccess#getHTMLContentReader(...):

In the case for our JSP proposals the content reader is null, so the "useAttachedJavadoc" block is called, which opens eventually opens the URL connection.  It looks like it's because member.getClassFile() in this case returns null.

In the case of a regular Java file, a content reader is return, apparently because member.getClassFile() actually returns a class file, and there's a buffer to read.

Here is the related WTP bug to reproduce the problem:

   https://bugs.eclipse.org/bugs/show_bug.cgi?id=124483

Let me know if I can provide more info.
Comment 1 Dani Megert CLA 2006-02-03 03:26:34 EST
It depends whether there's source (attached) or not. If no source is attached it tries to get it from attached Javadoc.

Which Eclipse build are you using? JDT Core improved the performance in that area. Also note that clients can set the timeout for getting the Javadoc from attached Javadoc, see Preference > Java > Content Assist > Work in Progress.
Comment 2 Phillip Avery CLA 2006-02-03 10:56:58 EST
WTP 1.5 still builds with eclipse 3.2M4

I can try a more recent build to see if the performance is better.
Comment 3 Dani Megert CLA 2006-02-03 11:02:12 EST
Please also give the preference a try. We could adapt the default if necessary.
Comment 4 Phillip Avery CLA 2006-02-13 16:32:01 EST
I tried I20060208-0848 and the performance is still very slow.

Adjusting the timeout preference didn't seem to have an effect.
I couldn't see anywhere in the code path were the preference was being used...

I see that JavaElement#getURLContents() tries to create an input stream each time, maybe this is part of the bottleneck?  If I no-op that method the time goes from ~18 seconds to ~6 seconds.  Still slow but about 1/3 the time.
Comment 5 Dani Megert CLA 2006-02-14 03:04:49 EST
>I couldn't see anywhere in the code path were the preference was being used...
Should be used in JDT Core code.
Comment 6 Tom Hofmann CLA 2006-02-21 01:34:03 EST
Just on a side-note - computing additional info will often be slow (javadoc extraction, html formatting...) and doing it for every proposal is not something you want to do if you have hundreds of proposals.

How about wrapping the proposals and only lazily computing the additional information upon request?
Comment 7 Tom Hofmann CLA 2006-03-14 01:24:16 EST
(In reply to comment #4)
> Adjusting the timeout preference didn't seem to have an effect.
> I couldn't see anywhere in the code path were the preference was being used...

AFAIK, the timeout only affects the retrieval of parameter names of methods, but not of the entire javadoc.

Retrieving javadoc for every proposal upfront will never perform. You should definitely try to delay this call.
Comment 8 Dani Megert CLA 2006-03-14 02:15:00 EST
Tom's correct: the preference is only used on J Core side when they resolve the parameter names upon completion proposal computation. In addition there's also bug 129168 on Platform Text side.
Comment 9 Phillip Avery CLA 2006-03-14 11:06:23 EST
As you suggested, wrapping a Java proposal w/ our JSP proposal and calculating getAdditionalInfo() only when required fixes the problem (and makes more sense than calcuating everything up front).

This one can probably be closed since we can fix from our end.
Comment 10 Frederic Fusier CLA 2006-08-11 07:03:39 EDT
=> close as WONTFIX
Comment 11 Dani Megert CLA 2006-08-14 03:47:43 EDT
See ICompletionProposalExtension5 (>= R3.2).