Bug 375582 - Slow Content Assist for new Lookup
Summary: Slow Content Assist for new Lookup
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2012-03-28 16:02 EDT by Nathan Reynolds CLA
Modified: 2023-01-12 10:39 EST (History)
2 users (show)

See Also:


Attachments
Call stacks at the time of the freeze (23.80 KB, text/plain)
2012-03-28 16:03 EDT, Nathan Reynolds CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Reynolds CLA 2012-03-28 16:02:01 EDT
Build Identifier: 20120216-1857

I am not sure if this goes under the UI or Core component.  Please re-assign if needed.

If I bring up Content Assist after typing "new X" or "new XY" (where X and Y are any letters), the entire IDE freezes for a couple of seconds.  I hear the disk churning.  In fact, the thread "main" is reading a zip file and the thread "org.eclipse.jdt.internal.ui.text.JavaReconciler" is opening a file.

If I type "new XYZ", then Content Assist appears quickly.

I will attach a file of all the call stacks at the time of the freeze.

If I could continue typing instead of waiting for Content Assist to show up that would be a good solution.  A better solution would be to have a background thread create a cache after the IDE has started and is usable.

Reproducible: Always

Steps to Reproduce:
1. Type "new T"
2. Bring up Content Assist
3. Note the IDE freezes for a couple of seconds and the disk churns
Comment 1 Nathan Reynolds CLA 2012-03-28 16:03:21 EDT
Created attachment 213311 [details]
Call stacks at the time of the freeze
Comment 2 Dani Megert CLA 2012-03-29 03:52:54 EDT
Constructor content assist is expensive, so it can take a while. How many seconds are "a couple" for you?

If it takes too long for you, you can reduce the timeout by setting the Java system property when starting Eclipse:
eclipse.exe -vmargs -Dorg.eclipse.jdt.ui.codeAssistTimeout=3000
(the value is in ms)
Comment 3 Nathan Reynolds CLA 2012-03-29 11:01:44 EDT
I didn't time it with a stop watch, but it takes about 3-4 seconds.  Is there any way to cache the results for constructor content assist?

I set "Auto activation triggers for Java" to ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".  This makes Content Assist popup all the time.  This really saves me a lot of keystrokes because most of the time I only have to hit 2-3 keys and Content Assist has the right identifier at the top of the list.  I just press enter and get the identifier or method call.

I hit the "new X" and "new XY" problem a lot because of the "Auto activation triggers".  Sure, I could remove the auto activation but that would definitely be much slower than waiting for the "new X" and "new XY" problem.

Setting the timeout lower is just a workaround.  Thanks for the tip.  I'll see how I like it.
Comment 4 Satyam Kandula CLA 2012-03-29 22:33:41 EDT
(In reply to comment #3)
> I didn't time it with a stop watch, but it takes about 3-4 seconds.  Is there
> any way to cache the results for constructor content assist?
Are the subsequent content assist's on new X's faster? If not, increasing memory for the eclipse process could help.
Comment 5 Nathan Reynolds CLA 2012-03-30 11:41:42 EDT
I edited eclipse.ini and changed -Xmx384m to -Xmx1024m.  I restarted Eclipse.  This had no effect on the response time.  In fact, I watched the heap usage progress bar in the lower left.  I even connected JConsole to Eclipse and monitored the heap usage.  The committed heap climbed to 272 MB.  -Xmx384m vs -Xmx1024m didn't make any impact on response time.

I noticed that there was 1 young garbage collection.  So, I changed -Xms40m to -Xms1024m.  This gets rid of the 1 young garbage collection, but there isn't really any change to response time.  The 1 young garbage collection took very little time.
Comment 6 Satyam Kandula CLA 2012-03-30 11:50:41 EDT
(In reply to comment #5)
> I edited eclipse.ini and changed -Xmx384m to -Xmx1024m.  I restarted Eclipse. 
> This had no effect on the response time.  In fact, I watched the heap usage
> progress bar in the lower left.  I even connected JConsole to Eclipse and
> monitored the heap usage.  The committed heap climbed to 272 MB.  -Xmx384m vs
> -Xmx1024m didn't make any impact on response time.
> 
> I noticed that there was 1 young garbage collection.  So, I changed -Xms40m to
> -Xms1024m.  This gets rid of the 1 young garbage collection, but there isn't
> really any change to response time.  The 1 young garbage collection took very
> little time.
Can you please also confirm if the subsequent content assist on new X helps? The Java elements are cached and the cache size depends on the max memory. If subsequent content assist is faster, it could mean that the cache is not overflowing.
Comment 7 Eclipse Genie CLA 2020-08-04 15:05:33 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Eclipse Genie CLA 2023-01-12 10:39:20 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.