Bug 269296 - [assist] "Java code assist took too long: the proposal list might be incomplete"
Summary: [assist] "Java code assist took too long: the proposal list might be incomplete"
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows NT
: P3 normal with 1 vote (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2009-03-18 18:08 EDT by Johan Compagner CLA
Modified: 2011-04-25 02:41 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Compagner CLA 2009-03-18 18:08:49 EDT
Code completion in the 3.5 stream is very annoying, its still the case with M6. Many many times if i do CTRL-SPACE nothing happens and i see the above method
When i press again CTRL-SPACE it might show the list, or again and it will show the list.

I already have turned off that content assist cycling (only have 1 now) because if i do that then i have to cycle first because the first popup doesnt show and i have to cycle through all the views to get back the the default and then i see the things i want to see.

I think somewhere the timer is to short, and it will kill of the search to soon. Strange thing is that i dont have really a slow laptop (2.2Ghz dual core and raid disks)
Comment 1 Johan Compagner CLA 2009-03-18 18:59:36 EDT
ok if i change this code:

	private static final long JAVA_CODE_ASSIST_TIMEOUT= 500; // ms

	private String fErrorMessage;

	private final IProgressMonitor fTimeoutProgressMonitor;

	public JavaCompletionProposalComputer() {
		fTimeoutProgressMonitor= createTimeoutProgressMonitor(JAVA_CODE_ASSIST_TIMEOUT);
	}


in JavaCompletionProposalComputer

to

	private static final long JAVA_CODE_ASSIST_TIMEOUT= 5000; // ms

(just randomly choosen, but way way more then 0.5 second)

then code completion always just works for me, and i can also turn on the cycling without any problems

So i guess with all these additions to the code completion it just does take a bit more time and now it is canceled way to early.

if i change it to 1000 (so double) then it sort of works. i get results but the list is pretty small (and i still get that error/warning message)
only when i change it to 1500, the message doesnt appear and i get everything.

I guess this timeout thing is really depending on your pc and how long a person does want to wait for it. So the best thing would be to have this in a preference (just like the javadoc argument get timeout)
But the default preference should really go up a bit..

Comment 2 Dani Megert CLA 2009-03-19 03:45:32 EDT
Johan, the question is why it takes that long. So far you are the first one reporting this problem and hence it would be good to know why it is (too) slow on your end.
Comment 3 Dani Megert CLA 2009-03-19 03:52:58 EDT
We don't want to make this timeout value appear in the preference UI but I think we will offer to set it via environment variable.
Comment 4 Johan Compagner CLA 2009-03-19 04:55:46 EDT
My best guess is:

sun.nio.cs.SingleByteDecoder.decode(int)
sun.nio.cs.SingleByteDecoder.decodeArrayLoop(ByteBuffer, CharBuffer)
sun.nio.cs.SingleByteDecoder.decodeLoop(ByteBuffer, CharBuffer)
java.nio.charset.CharsetDecoder.decode(ByteBuffer, CharBuffer, boolean)
sun.nio.cs.StreamDecoder.implRead(char[], int, int)
sun.nio.cs.StreamDecoder.read(char[], int, int)
java.io.InputStreamReader.read(char[], int, int)
java.io.BufferedReader.read1(char[], int, int)
java.io.BufferedReader.read(char[], int, int)
org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(InputStream, int, String)
org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(IFile, String)
org.eclipse.jdt.internal.core.CompilationUnit.getContents()
org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.getSource()
org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convertAnnotations(IAnnotatable)
org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convert(SourceType, CompilationResult)
org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convert(ISourceType[], CompilationResult)
org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.buildCompilationUnit(ISourceType[], int, ProblemReporter, CompilationResult)
org.eclipse.jdt.internal.codeassist.impl.Engine.accept(ISourceType[], PackageBinding, AccessRestriction)
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(PackageBinding, char[])
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(char[])
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(char[][], int)
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(char[][], int, boolean)
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports()
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes()
org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(ICompilationUnit, int, int, ITypeRoot)
org.eclipse.jdt.internal.core.Openable.codeComplete(ICompilationUnit, ICompilationUnit, int, CompletionRequestor, WorkingCopyOwner, ITypeRoot, IProgressMonitor)
org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(int, CompletionRequestor, WorkingCopyOwner, IProgressMonitor)
org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(int, CompletionRequestor, IProgressMonitor)
org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(int, JavaContentAssistInvocationContext)
org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor)
org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposalComputer.computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor)
org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor)
org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(ContentAssistInvocationContext, String, SubProgressMonitor)
org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ITextViewer, int, IProgressMonitor, ContentAssistInvocationContext)
org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ITextViewer, int)
org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ITextViewer, int)
org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(int)
org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup, int)
org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run()
org.eclipse.swt.custom.BusyIndicator.showWhile(Display, Runnable)
org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(boolean)
org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions()
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(int)
org.eclipse.ui.texteditor.ContentAssistAction$1.run()
org.eclipse.swt.custom.BusyIndicator.showWhile(Display, Runnable)
org.eclipse.ui.texteditor.ContentAssistAction.run()
org.eclipse.jface.action.Action.runWithEvent(Event)



So its the imports and that is i think the first thing it does so if that one takes to long i dont see anything in the list.
Comment 5 Johan Compagner CLA 2009-03-19 05:11:22 EDT
yes it is really that code:

CompilationUnitScope
public void faultInTypes() {
	long time = System.currentTimeMillis();
	faultInImports();

	for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
		this.topLevelTypes[i].faultInTypesForFieldsAndMethods();
	System.err.println(" time: " + (System.currentTimeMillis()-time));
}

there i print the time this is what i get when i code complete 4 times:

 time: 807
 time: 128
 time: 882
 time: 125

so first time, no proposals, second time everything, 3th nothing again and 4th proposals.

if i just comment out that stuff the code completion gives me nothing very very fast, so all the time is really in there.
Comment 6 Johan Compagner CLA 2009-03-19 05:57:22 EDT
yes it is really in the building of the compilation units (and there are a lot!)

you guys already had your own timing (commented) in SourceTypeConverter.buildCompilationUnit():

long start = System.currentTimeMillis();
		SourceTypeConverter converter = new SourceTypeConverter(flags, problemReporter);
		try {
			return converter.convert(sourceTypes, compilationResult);
		} catch (JavaModelException e) {
			return null;
		} finally {
			System.out.println("Spent " + (System.currentTimeMillis() - start) + "ms to convert " + ((JavaElement) converter.cu).toStringWithAncestors());
		}

i enabled that and this is my output of 1 code completion:


Spent 14ms to convert PartsScrollPane.java [in com.servoy.j2db.util.gui [in src [in j2db]]]
Spent 13ms to convert EnablePanel.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 11ms to convert ISkinnable.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 11ms to convert IScrollPane.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 10ms to convert EnableScrollPanel.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 8ms to convert FixedJScrollPane.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 7ms to convert IDelegate.java [in com.servoy.j2db.util [in src [in j2db_core]]]
Spent 6ms to convert IFormUIInternal.java [in com.servoy.j2db [in src [in j2db]]]
Spent 8ms to convert IFormUI.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert IComponent.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 5ms to convert IFocusCycleRoot.java [in com.servoy.j2db.util [in src [in j2db]]]
starting faultInTypes()
Spent 6ms to convert ISupportFocusTransfer.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 7ms to convert JavaMembers.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 8ms to convert NativeJavaMethod.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 10ms to convert BaseFunction.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 8ms to convert IdScriptableObject.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 9ms to convert ScriptableObject.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 7ms to convert Scriptable.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 6ms to convert DebuggableObject.java [in org.mozilla.javascript.debug [in src [in rhino16r7]]]
Spent 7ms to convert ConstProperties.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 11ms to convert IdFunctionCall.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 7ms to convert Function.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 6ms to convert Callable.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 7ms to convert NativeJavaObject.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 6ms to convert Wrapper.java [in org.mozilla.javascript [in src [in rhino16r7]]]
Spent 7ms to convert BufferedDataSet.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 6ms to convert IDataSet.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 7ms to convert CellAdapter.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 7ms to convert IDataAdapter.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 8ms to convert IModificationListener.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 9ms to convert IEditListener.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 8ms to convert FoundSetManager.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 7ms to convert IFoundSetManagerInternal.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 6ms to convert IFoundSetManager.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 7ms to convert IManager.java [in com.servoy.j2db [in src [in j2db_core]]]
Spent 6ms to convert IDatabaseManager.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 5ms to convert ISaveConstants.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 6ms to convert IFoundSetInternal.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 7ms to convert IFoundSet.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 8ms to convert IFoundSetDeprecated.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 6ms to convert IGlobalValueEntry.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 9ms to convert JSDataSet.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 9ms to convert IFoundSetEventListener.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 12ms to convert PrototypeState.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 10ms to convert Record.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 13ms to convert IRecordInternal.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 8ms to convert IRecord.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 6ms to convert IRecordDeprecated.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 6ms to convert IRowChangeListener.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 7ms to convert ComponentFactory.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 7ms to convert DataRenderer.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 6ms to convert IDataRenderer.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert IContainer.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 7ms to convert ISupportDragNDrop.java [in com.servoy.j2db.dnd [in src [in j2db]]]
Spent 8ms to convert DataTextArea.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 6ms to convert IDisplayData.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 7ms to convert IDisplay.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 6ms to convert IFieldComponent.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 9ms to convert IAccessible.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 7ms to convert IScriptTextAreaMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 8ms to convert IScriptTextInputMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 15ms to convert IScriptInputMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 7ms to convert IScriptTransparentMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert IScriptBaseMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 9ms to convert IScriptReadOnlyMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 8ms to convert IScriptScrollableMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 11ms to convert IFixedPreferredWidth.java [in com.servoy.j2db.printing [in src [in j2db]]]
Spent 11ms to convert ISupportCachedLocationAndSize.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert ISupplyFocusChilderen.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 8ms to convert FormLookupPanel.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 6ms to convert IFormLookupPanel.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert ISupportAsyncLoading.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 6ms to convert InvisibleBean.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 11ms to convert PortalComponent.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 7ms to convert ISupportXMLOutput.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 6ms to convert IPortalComponent.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 7ms to convert IDisplayRelatedData.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 7ms to convert ISupportRowBGColorScript.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert IScriptPortalComponentMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert SolutionSkin.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 9ms to convert SpecialTabPanel.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 7ms to convert ITabPanel.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 7ms to convert IDepricatedScriptTabPanelMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 6ms to convert IScriptTabPanelMethods.java [in com.servoy.j2db.ui [in src [in j2db]]]
Spent 5ms to convert IModifyableRelationDisplay.java [in com.servoy.j2db.dataprocessing [in src [in j2db]]]
Spent 7ms to convert VisibleBean.java [in com.servoy.j2db.dataui [in src [in j2db]]]
Spent 8ms to convert Part.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 8ms to convert AbstractBase.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 7ms to convert IPersist.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 7ms to convert ISupportSize.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 14ms to convert IPersistCloneable.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 9ms to convert ICloneable.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 17ms to convert Table.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 7ms to convert ITable.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 6ms to convert ISupportUpdateableName.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 6ms to convert ISupportName.java [in com.servoy.j2db.persistence [in src [in j2db_core]]]
Spent 27ms to convert FormPreviewPanel.java [in com.servoy.j2db.printing [in src [in j2db]]]
Spent 7ms to convert IPrintInfo.java [in com.servoy.j2db.printing [in src [in j2db]]]
Spent 9ms to convert PageList.java [in com.servoy.j2db.printing [in src [in j2db]]]
Spent 13ms to convert PrintPreview.java [in com.servoy.j2db.printing [in src [in j2db]]]
Spent 8ms to convert ElementScope.java [in com.servoy.j2db.scripting [in src [in j2db]]]
Spent 6ms to convert DefaultScope.java [in com.servoy.j2db.scripting [in src [in j2db_core]]]
Spent 7ms to convert JSEvent.java [in com.servoy.j2db.scripting [in src [in j2db]]]
Spent 6ms to convert ScriptObjectRegistry.java [in com.servoy.j2db.scripting [in src [in j2db_core]]]
Spent 7ms to convert TwoNativeJavaObject.java [in com.servoy.j2db.scripting [in src [in j2db]]]
Spent 6ms to convert AutoTransferFocusListener.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 6ms to convert Debug.java [in com.servoy.j2db.util [in src [in j2db_core]]]
Spent 6ms to convert FocusCycleEntry.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 8ms to convert ITabPaneAlike.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 7ms to convert Slider.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 7ms to convert OrientationApplier.java [in com.servoy.j2db.util.gui [in src [in j2db]]]
Spent 3ms to convert FormController.java [in com.servoy.j2db [in src [in j2db]]]
Spent 7ms to convert IForm.java [in com.servoy.j2db [in src [in j2db_core]]]
Spent 10ms to convert IFoundSetListener.java [in com.servoy.j2db.dataprocessing [in src [in j2db_core]]]
Spent 11ms to convert IPrepareForSave.java [in com.servoy.j2db [in src [in j2db_core]]]
Spent 6ms to convert IScriptExecuter.java [in com.servoy.j2db [in src [in j2db]]]
Spent 8ms to convert ControllerUndoManager.java [in com.servoy.j2db [in src [in j2db]]]
Spent 6ms to convert IView.java [in com.servoy.j2db [in src [in j2db]]]
Spent 7ms to convert IApplication.java [in com.servoy.j2db [in src [in j2db]]]
Spent 7ms to convert IBasicApplication.java [in com.servoy.j2db [in src [in j2db]]]
Spent 7ms to convert IUIBlocker.java [in com.servoy.j2db.util [in src [in j2db]]]
Spent 6ms to convert IServiceProvider.java [in com.servoy.j2db [in src [in j2db_core]]]
Spent 6ms to convert IEventDelegator.java [in com.servoy.j2db [in src [in j2db_core]]]
Spent 8ms to convert DesignModeCallbacks.java [in com.servoy.j2db [in src [in j2db]]]
 total time in faultInTypes(): 902


thats just huge... 
Cant those compilation units be cached somewhere? And then flushed when the resource is touched?

Comment 7 Dani Megert CLA 2009-03-19 09:03:49 EDT
I've added a system property to control the timeout:
org.eclipse.jdt.ui.codeAssistTimeout

Let's use this bug for the perf issue in JDT Core. 
Comment 8 Frederic Fusier CLA 2009-03-19 09:40:57 EDT
+1

I also get empty lists from time to time during completion (David saw it the last time it happened to me). But as they were already several performances optimizations in this area, I doubt there's something else to do, I guess David will confirm/infirm this assumption...

By the way, I do not really understand why this timeout could not be accessible through preferences? I do not think it should hurt a lot if it would be placed in an advanced tab or limited by a max value?
Comment 9 Dani Megert CLA 2009-03-19 09:49:35 EDT
The problem is that this is a very technical limit that we cannot guarantee i.e. it's not what the user will see given we also spend time for other processors where we cannot control the timeout and given we also use time to render the stuff.
Comment 10 Johan Compagner CLA 2009-03-19 09:53:34 EDT
personally i even dont see why there is really a max

If i press code completion i just want to have code completion.

The max in my eyes is more to cover if there is a bug in eclipse that it will never come out of and give us results

But if if it takes 2 seconds i want to wait for it. If it then gives me those results...

So in my eyes the 0.5 seconds that is now is really way to small, because as i said that number should only be as a last resort.

Just ask your self, why would you stop after 0.5 seconds if in 0.8 seconds it would give you the complete list? ?Now i have to press over and over and hopefully the os die cache enough so that it can quickly return the files that are all read in over and over again (and encoded thats where the real problems is in)

If it was me just tenfold that value to 5000
Comment 11 Dani Megert CLA 2009-03-19 09:59:24 EDT
Right, I consider increasing it a bit.
Comment 12 Markus Keller CLA 2009-03-19 11:07:13 EDT
I get the "Java code assist took too long..." message every time I invoke content assist after "new Lo" in org.eclipse.jdt.ui.tests.model.ContentProviderTests.
Comment 13 Johan Compagner CLA 2009-03-19 11:10:01 EDT
By the way i am ofcourse not saying that you shouldnt enhance the performance :)

But with the current setup, and loading and char encode all those java files does take time. I think how bigger the workspace and the file (how much more the file will touch) how easier we will be over those .500 seconds..

And thats not directly a fault of eclipse its just the way it is


I changed this:

private BufferCache openBuffers = new BufferCache(60);

to

private BufferCache openBuffers = new BufferCache(200);

and just added created buffers in CompilationUnit.getContents() when there was no hit.
And then after the first time, it worked a lot better.
But i guess thats not something we want (and there is some comment about not closing buffers and so on)

Another thing: What makes way more sense to me if you want to control the execution of the ContentAssist is not to think in times of seconds but to think in numbers found. If the content assist is busy and takes a long time because it does find 100+ entries then you can just say enough is enough.. and display the things you found until now.
The only thing is if i then starting typing really a search should be done again to see if it matches on stuff that you didnt get to the last time.
Comment 14 David Audel CLA 2009-03-19 11:20:08 EDT
(In reply to comment #4)

We already fix a bug in this area in 3.5M7.
SourceTypeConverter.getSource() is not called anymore if the CompilationUnit doesn't contain an annotation (bug 268802)

If the compilation units in 'j2db' and 'j2db_core' doesn't contain annotations this could improve performance.
Could you try your test case with 3.5M7 to verify if this fix change something for you ?
Comment 15 Johan Compagner CLA 2009-03-19 11:26:55 EDT
i will move to the next integration build that will pass by and will then test the stuff.

If it does contain annotation what then? Then i still have the same performance?
But every bit helps ofcourse.
Comment 16 David Audel CLA 2009-03-19 11:39:20 EDT
If it contains annotations then the performance will be the same and i should find another way to improve performance :)

Comment 17 Johan Compagner CLA 2009-03-26 05:46:40 EDT
> We already fix a bug in this area in 3.5M7.
> SourceTypeConverter.getSource() is not called anymore if the CompilationUnit
> doesn't contain an annotation (bug 268802)

I am currently testing I20090325-1135 and still my compilation units are parsed.
But in 1.5 we have annotations pretty often for example @override ...

But something did change for the better. because if i set the timeout back to 500 in the debugger. I dont seem to get easy completely empty list back. Its not working completely because i do get half done list (and a notice that the completion engine did take to long) but it isnt as worse as it was before. 

But with the new timeout my code completion works perfect now.
Comment 18 Klaus Dicks CLA 2009-06-18 05:18:08 EDT
I get the timeout message nearly every time I use code assit. That's really show stopping. 

I'm using RC4 on a Debian Linux PC with an Intel Core Duo E8500 3 GHz and 4 GB Memory.
There were no problems with 3.4.2.
Comment 19 Dani Megert CLA 2009-06-18 05:20:27 EDT
Can you provide more details about your setup? Are you using plain Eclipse SDK or eventually Mylyn?
Comment 20 Klaus Dicks CLA 2009-06-18 05:28:26 EDT
Hello Dani,

I'm not using Mylyn. I'm using Eclipse 3.5 Build id: I20090605-1444 on an Debian Linux PC with Java Runtime 1.6.0_12-b04. Processor is Intel Core Duo E8500 3 Ghz and 4 GB Memory.
Comment 21 Dani Megert CLA 2009-06-18 05:30:52 EDT
It would help if you could provide a test case that causes this long delay and hence the message.
Comment 22 Klaus Dicks CLA 2009-06-18 08:01:31 EDT
How can I configure the Systemproperty mentioned in comment#7? There is no effective working possible.
Comment 23 Dani Megert CLA 2009-06-18 08:42:14 EDT
It's a Java system property and hence you set it like any other Java system property ;-)

Use -vmargs -Dorg.eclipse.jdt.ui.codeAssistTimeout=VALUE
where VALUE is the timeout in ms.
Comment 24 Klaus Dicks CLA 2009-06-18 10:55:33 EDT
Even if I define a timeout of 50000 and enter a full Java Type name the assist comes up with a timeout. Thats not useable for me, I'm going back to 3.4.2

What information can I provide to analyse and fix this bug?
Comment 25 Johan Compagner CLA 2009-06-18 11:01:15 EDT
can you time when the the time out happens?

I personally dont have any problems anymore and i do think setting that system property is not really needed anymore because the default timeout (last time i checked) is already upped to 5000 (instead of 500 what it was first)

I guess you are not really waiting for 5 seconds and then you get your time out right?
Comment 26 Dani Megert CLA 2009-06-18 11:05:09 EDT
Do you get a message in the status line or a dialog? Also, are you 100% sure that you've set the system property correctly and that you are not having Mylyn (e.g. because you downloaded a j2ee package)?
Comment 27 Ivan Meredith CLA 2009-07-14 19:29:02 EDT
I have the same problem. 

I have the jee version of 3.5,  3 Java projects, and 3 dynamic web projects are setup on it. I have not installed any extra plugins. Same setup works fine with 3.4.x

Doing Obj [ctrl-space] brings up the window "Problems during Content Assist" then mentions org.eclipse.jdt.ui (depending on the content assist settings its sometimes something about mylyn

Going back to 3.4 for now, but can provide more info if someone tells me how to get it.
Comment 28 Dani Megert CLA 2009-07-15 03:15:28 EDT
If setting the timeout doesn't work, then it is probably because the indexer is either not finished or somehow broken and thinks it's never finished, see bug 281871 and bug 281598.
Comment 29 Olivier Thomann CLA 2011-03-15 11:29:00 EDT
David has left the team.
Johan, do you still experience the same problem with 3.7M6?
Comment 30 Johan Compagner CLA 2011-03-15 11:40:16 EDT
no i haven't experienced these problems for quite some time now, i also think it was already fixed in 3.6 for me
I think the trigger for me was that 500 to 5000 

As far as i am concerned this bug can be closed.
Comment 31 Olivier Thomann CLA 2011-03-15 12:01:10 EDT
Closing as WORKSFORME.
Comment 32 Srikanth Sankaran CLA 2011-04-25 02:41:06 EDT
Verified for 3.7 M7