Bug 134255 - Unoptimal JavaElementInfo construction
Summary: Unoptimal JavaElementInfo construction
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 92367 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-31 08:50 EST by Philipe Mulet CLA
Modified: 2006-04-13 13:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2006-03-31 08:50:24 EST
Build 20060330-2000

During long reconcile (GenericTypeTest), I observed the following trace:
"org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x29bc2f20 nid=0xfa0 runnable [0x2b1af000..0x2b1af9e8]
        at java.lang.String.equals(String.java:858)
        at org.eclipse.jdt.internal.core.JavaElement.equals(JavaElement.java:120)
        at org.eclipse.jdt.internal.core.SourceRefElement.equals(SourceRefElement.java:83)
        at org.eclipse.jdt.internal.core.SourceMethod.equals(SourceMethod.java:50)
        at org.eclipse.jdt.internal.core.JavaElementInfo.includesChild(JavaElementInfo.java:73)
        at org.eclipse.jdt.internal.core.JavaElementInfo.addChild(JavaElementInfo.java:40)
        at org.eclipse.jdt.internal.core.CompilationUnitStructureRequestor.enterMethod(CompilationUnitStructureRequestor.java:319)
        at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1202)
        at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1456)
        at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1047)
        at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:1520)
        at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:134)
        at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:229)
        at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:505)
        at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:990)
        at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:131)
        at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:71)
        at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
        at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:779)
        at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1117)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:97)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:145)
        at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
        at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:94)
        at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75)
        at org.eclipse.jdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:339)
        - locked <0x0b24a1e0> (a java.lang.Object)
        at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)



After closer look, the addition of child infos looks unoptimized.
1. it checks for existence, where in this scenario it should trust parser to not recreate same element
2. it grows array one by one, resulting in lots of garbagge being allocated.
Comment 1 Jerome Lanneluc CLA 2006-03-31 09:07:37 EST
*** Bug 92367 has been marked as a duplicate of this bug. ***
Comment 2 Philipe Mulet CLA 2006-04-04 04:36:58 EDT
+1 for 3.2RC1
Comment 3 Jerome Lanneluc CLA 2006-04-04 04:55:04 EDT
Changed CompilationUnitStructurRequestor to set the children of a member at once.

Also changed ClassFile#buildStructure(...) and JavaModel#buildStructure(...) to set the children at once (and not call addChild(...)).

Note that JavaElementInfo#addChild(...) still checks if the child is present as this can be called several times for the same child. However this is now called in the DeltaProcessor only.
Comment 4 David Audel CLA 2006-04-13 13:13:48 EDT
Verified for 3.2 RC1 using build I20060413-0010