Bug 13393 - Extremely poor java editor performance in 2002040x
Summary: Extremely poor java editor performance in 2002040x
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 13468 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-04-10 12:54 EDT by Igor Fedorenko CLA
Modified: 2002-04-17 03:44 EDT (History)
7 users (show)

See Also:


Attachments
Example project (2.25 KB, application/octet-stream)
2002-04-10 12:55 EDT, Igor Fedorenko CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Fedorenko CLA 2002-04-10 12:54:55 EDT
Steps to reproduce

1. Start new workspace and import attached project p1 into it.

2. Make sure that all jar files referenced by p1 are accessible. To be honest, 
I took arbitrary nine jar files and weblogic.jar (because of its gigantic size 
of 26 megs), you probably should not be too concerned about exact set of jar 
files.

3. It takes more then 30 seconds to open p1/src/test1/Test1.java file in java 
editor, Cpu is 100% utilized but no disk trashing. Editing the file is also 
somewhat awkward.

I知 running Win2k/SP2, 512M RAM, PIII/600. Eclipse 20020409, Sun JDK 1.3.1-b24.



PS: following is an example of thread dump available when running Eclipse with -
consoleLog option:

"main" prio=5 tid=0x234778 nid=0x724 runnable [0x6e000..0x6fc34]
	at org.eclipse.jdt.internal.core.util.LRUCache.privateAdd
(LRUCache.java:295)
	at org.eclipse.jdt.internal.core.OverflowingLRUCache.put
(OverflowingLRUCache.java:349)
	at org.eclipse.jdt.internal.core.JavaModelCache.putInfo
(JavaModelCache.java:132)
	at org.eclipse.jdt.internal.core.JavaModelManager.putInfo
(JavaModelManager.java:858)
	at 
org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeJarChildren
(JarPackageFragmentRoot.java:305)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeChildren
(JarPackageFragmentRoot.java:183)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.generateInfos
(PackageFragmentRoot.java:170)
	at org.eclipse.jdt.internal.core.Openable.buildStructure
(Openable.java:63)
	at org.eclipse.jdt.internal.core.Openable.openWhenClosed
(Openable.java:394)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.openWhenClosed
(PackageFragmentRoot.java:325)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.openWhenClosed
(JarPackageFragmentRoot.java:592)
	at org.eclipse.jdt.internal.core.JavaElement.openHierarchy
(JavaElement.java:497)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:287)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren
(JavaElement.java:244)
	at org.eclipse.jdt.internal.core.NameLookup.seekPackageFragments
(NameLookup.java:501)
	at org.eclipse.jdt.internal.core.NameLookup.findType
(NameLookup.java:355)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.find
(SearchableEnvironment.java:49)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.findType
(SearchableEnvironment.java:128)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:85)
	at 
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage
(PackageBinding.java:166)
	at 
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findOnDemandImport
(CompilationUnitScope.java:272)
	at 
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleTypeImpo
rt(CompilationUnitScope.java:327)
	at 
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports
(CompilationUnitScope.java:222)
	at 
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes
(CompilationUnitScope.java:258)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:559)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.resolve
(CompilationUnitProblemFinder.java:151)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure
(CompilationUnit.java:80)
	at org.eclipse.jdt.internal.core.Openable.openWhenClosed
(Openable.java:394)
	at org.eclipse.jdt.internal.core.WorkingCopy.openWhenClosed
(WorkingCopy.java:303)
	at org.eclipse.jdt.internal.core.Openable.open(Openable.java:330)
	at org.eclipse.jdt.internal.core.WorkingCopy.open(WorkingCopy.java:283)
	at org.eclipse.jdt.internal.core.CompilationUnit.getWorkingCopy
(CompilationUnit.java:587)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createEle
mentInfo(CompilationUnitDocumentProvider.java:355)
	at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect
(AbstractDocumentProvider.java:247)
	at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput
(AbstractTextEditor.java:1503)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput
(JavaEditor.java:479)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput
(CompilationUnitEditor.java:932)
	at org.eclipse.ui.texteditor.AbstractTextEditor.init
(AbstractTextEditor.java:1146)
	at org.eclipse.ui.internal.EditorManager.createSite
(EditorManager.java:485)
	at org.eclipse.ui.internal.EditorManager.access$1
(EditorManager.java:483)
	at org.eclipse.ui.internal.EditorManager$2.run(EditorManager.java:467)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
	at org.eclipse.ui.internal.EditorManager.openInternalEditor
(EditorManager.java:460)
	at org.eclipse.ui.internal.EditorManager.openInternalEditor
(EditorManager.java:529)
	at org.eclipse.ui.internal.EditorManager.openEditor
(EditorManager.java:361)
	at org.eclipse.ui.internal.EditorManager.openEditor
(EditorManager.java:274)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor
(WorkbenchPage.java:1567)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor
(WorkbenchPage.java:1474)
	at org.eclipse.ui.actions.OpenFileAction.openFile
(OpenFileAction.java:91)
	at org.eclipse.ui.actions.OpenSystemEditorAction.run
(OpenSystemEditorAction.java:91)
	at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction
(OpenActionGroup.java:102)
	at 
org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup.runDefaultAction
(ResourceNavigatorActionGroup.java:152)
	at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen
(ResourceNavigator.java:441)
	at org.eclipse.ui.views.navigator.ResourceNavigator$6.open
(ResourceNavigator.java:245)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen
(StructuredViewer.java:300)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen
(StructuredViewer.java:460)
	at org.eclipse.jface.viewers.AbstractTreeViewer$2.handleOpen
(AbstractTreeViewer.java:633)
	at org.eclipse.jface.util.OpenStrategy.handleOpen(OpenStrategy.java:134)
	at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:131)
	at org.eclipse.jface.util.OpenStrategy$8.handleEvent
(OpenStrategy.java:299)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:115)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:75)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1412)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1208)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:836)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:819)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:777)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:190)
	at org.eclipse.core.launcher.Main.run(Main.java:549)
	at org.eclipse.core.launcher.Main.main(Main.java:390)
Comment 1 Igor Fedorenko CLA 2002-04-10 12:55:52 EDT
Created attachment 571 [details]
Example project
Comment 2 gavlin CLA 2002-04-10 18:44:17 EDT
I also have weblogic.jar on my classpath and am experiencing the same problems. 
Build 0328 opened large or small files in the Java Editor in < 2 seconds. 
Builds 040x require 15-30 seconds to open even the smallest files. During the 
wait, the CPU is pegged 100%. The new builds are unusable in this state.
Comment 3 Philipe Mulet CLA 2002-04-11 09:50:46 EDT
Several issues here... currently, even when disabling temporary problems in 
editor, the infrastructure still computes them. We will make sure not to do so 
anymore (which should bring you back to previous performance if no problem is 
displayed).

We still need to optimize the computation of these problems (looks like it is 
causing some heavy cache flushing - due to the nature of the compiler name 
environment used there - SearchableEnvironment against the JavaModel).

Looks like UI also did perform tons of unnecessary refresh (this should be 
improved in today's integration build too).

Keeping this bug open until we have decent performance on big files with error 
detection enabled.
Comment 4 gavlin CLA 2002-04-12 10:26:12 EDT
I downloaded the 20020411 build last night and experienced minimal if any 
performance improvement. Note: I was running w/"temporary problems" disabled.
Comment 5 Kim Rasmussen CLA 2002-04-14 05:02:02 EDT
I think that the performance slowdown has everything todo with the number of 
classes in the projects build-path.

With weblogic.jar (which is about 25 megs) in the buildpath, it easily takes 30 
seconds with 100% CPU to open a file containing a servlet.

Code-assist is also equally unusable for such files - 20-30 seconds of 100% CPU 
to process a "this.<ctrl-space>"

If I remove weblogic.jar from the classpath and replace it with servlet.jar 
from tomcat (40K) then it takes less than a second to open the file.

Unfortunately, it makes builds >= 20020404 pretty much unusable it you are 
forced to have large .jar files in your build path.

I have tried playing around with the settings in the editor that have to do 
with parsing the file, but I didn't find anything that makes a difference.
Comment 6 oliver jehle CLA 2002-04-15 08:03:05 EDT
>currently, even when disabling temporary problems in 
>editor, the infrastructure still computes them. We will make sure not to do so 
>anymore (which should bring you back to previous performance if no problem is 
>displayed).

can you tell when this workaround will be fixed (build ??)  ???? 



Comment 7 Kim Rasmussen CLA 2002-04-15 09:36:35 EDT
Is it too late to get it in M5 ? In reality, it makes Eclipse nearly unusable, 
since I have projects that depend heavily upon the weblogic.* classes.

Not getting this fixed in M5 would really mean I have to wait for M6, and keep 
using M4 until then.
Comment 8 Philipe Mulet CLA 2002-04-15 10:29:36 EDT
As soon as we have a good fix for this one, we will post it as a patch for M5 
on the JDT/Core dev page.

For M5, we did ensure that the editor would not attempt to compute errors if 
explicitely told not to (temporary problems setting).

Now on the good new, we think we know what is going on. The JavaModel cache 
isn't able to scale to address large workspaces, containing more than a 1000 
packages at once. It will enter a mode where every single Java operation is 
really expensive... we are working on a patch, and we plan to post it asap to 
get some feedback.

Comment 9 Kim Rasmussen CLA 2002-04-15 12:49:32 EDT
Great, as long as I can turn it off in the settings, I can use it.

Thanks.
Comment 10 Philipe Mulet CLA 2002-04-15 12:57:34 EDT
A performance patch is posted on Jdt/Core resource dev page.
Feedback would be much appreciated.

Link to patch: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-
home/org.eclipse.jdt.core239b.zip

Comment 11 gavlin CLA 2002-04-15 13:05:33 EDT
Philippe, am I correct that the ">1000 packages in workspace" performance 
problems experienced in all 040x builds thus far will only appear in M5 if 
the "temporary problems" setting is enabled?
Comment 12 Kim Rasmussen CLA 2002-04-15 13:10:02 EDT
Since M5 isn't available yet, I applied the patch to the latest integration 
build (0412).

Apart from an entry in the errorlog first time I restarted eclipse, it seems to 
work perfectly.

I have included the entry from the error-log, but it only occured the first 
time I restarted, not subsequent times.

<log-entry date="Mon Apr 15 20:11:57 CEST 2002">
  <status
     plugin-id="org.eclipse.ui"
     severity="WARNING"
     message="Problems occurred when invoking code from plug-in: 
org.eclipse.ui."
     code="2">
    <exception
       message="org.eclipse.jdt.internal.core.Buffer"
       trace="
java.lang.ClassCastException: org.eclipse.jdt.internal.core.Buffer
        at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createEle
mentInfo(CompilationUnitDocumentProvider.
java:429)
        at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect
(AbstractDocumentProvider.java:247)
        at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput
(AbstractTextEditor.java:1503)
        at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput
(JavaEditor.java:479)
        at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput
(CompilationUnitEditor.java:932)
        at org.eclipse.ui.texteditor.AbstractTextEditor.init
(AbstractTextEditor.java:1146)
        at org.eclipse.ui.internal.EditorManager.createSite
(EditorManager.java:485)
        at org.eclipse.ui.internal.EditorManager.access$1
(EditorManager.java:483)
        at org.eclipse.ui.internal.EditorManager$2.run(EditorManager.java:467)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
        at org.eclipse.ui.internal.EditorManager.openInternalEditor
(EditorManager.java:460)
        at org.eclipse.ui.internal.EditorManager.openInternalEditor
(EditorManager.java:529)
        at org.eclipse.ui.internal.EditorManager.access$3
(EditorManager.java:524)
        at org.eclipse.ui.internal.EditorManager$5.run(EditorManager.java:636)
        at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:838)
        at org.eclipse.core.runtime.Platform.run(Platform.java:411)
        at org.eclipse.ui.internal.EditorManager.restoreState
(EditorManager.java:590)
        at org.eclipse.ui.internal.WorkbenchPage.restoreState
(WorkbenchPage.java:1708)
        at org.eclipse.ui.internal.WorkbenchPage.&lt;init&gt;
(WorkbenchPage.java:308)
        at org.eclipse.ui.internal.WorkbenchWindow.restoreState
(WorkbenchWindow.java:940)
        at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:794)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:632)
        at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:838)
        at org.eclipse.core.runtime.Platform.run(Platform.java:411)
        at org.eclipse.ui.internal.Workbench.openPreviousWorkbenchState
(Workbench.java:610)
        at org.eclipse.ui.internal.Workbench.openWindows(Workbench.java:667)
        at org.eclipse.ui.internal.Workbench.init(Workbench.java:503)
        at org.eclipse.ui.internal.Workbench.run(Workbench.java:816)
        at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:777)
        at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:190)
        at org.eclipse.core.launcher.Main.run(Main.java:549)
        at org.eclipse.core.launcher.Main.main(Main.java:390)
">
    </exception>
  </status>
</log-entry>
Comment 13 Philipe Mulet CLA 2002-04-15 14:22:48 EDT
I have seen this dump in the error log as well. Will see with JDT/UI who's 
responsible for it. Thanks for the feedback.
Comment 14 Kim Rasmussen CLA 2002-04-15 16:39:19 EDT
hmm... you should be careful about applying the patch - I got some weird errors 
after applying it to the integration build 20020412.

Basically, after applying it my .java files were never saved to the disk. 
Eclipse claimed to have compiled them, but they never ended up getting saved to 
the disk, so it took me a little time to track down why my changes were lost 
when I used ant to build outside of eclipse.
Comment 15 oliver jehle CLA 2002-04-16 02:25:14 EDT
after patching integration build 1204 motif-linux i can work with the
weblogic.jar in the build path !!!!!

i also checked the disk-saved objects and the commited cvs objects and they are
all saved !!! 

we will test it under windows2000 today... 
Comment 16 Morten Wilken CLA 2002-04-16 05:22:16 EDT
i too applæied it to build 20024012 and experienced that my .java files was'nt 
saved.
Comment 17 oliver jehle CLA 2002-04-16 07:16:28 EDT
i'm sorry for my last posting... 

i applied the patch to integration build 1104... not as posted soon 1204 

with build 1104 and the patch, the linux-motif and windows version work. if you
change a java object and save it, its written to the filesystem. 



Comment 18 Philipe Mulet CLA 2002-04-16 07:26:07 EDT
We think we have resolved the other issues as well (ClassCastException + 
unsaved changes). Along with the performance patch, we fixed a leak in the 
buffer caching, which would cause it to keep closed buffers. 

When fixing this, closed buffers were gone, but reaccessing such a buffer would 
cause the buffer type to become wrong and misbehave from there on. Buffer 
closing opens when overflowing the buffer cache.

Improved patch 239c got posted on Jdt/Core resource dev page.

Fixed.
Comment 19 Martin Aeschlimann CLA 2002-04-17 03:44:44 EDT
*** Bug 13468 has been marked as a duplicate of this bug. ***