Bug 27670

Summary: ClasspathEntry.rootID allocates a lot of throw-away objects
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 Keywords: performance
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2002-12-04 11:33:42 EST
every time ClasspathEntry.rootID() is called (which happens quite a lot)
a new StringBuffer is created, then a new string is appended to it and the 
buffer is toString'd.

the code is sth like:
 case IClasspathEntry.CPE_LIBRARY :
    return "[LIB]"+this.path;  //$NON-NLS-1$

maybe this could be avoided somehow - i'm not sure but if the entry kind are 
the path are not-modifiable (which seems to be the case), then rootID can be 
computed only once for each object.

however, that said, i did not check if it really is the case that rootID is 
indeed called many times on the same object.
if it is not true - feel free to close as 'bogus'. i mean, as 'invalid'.
Comment 1 Philipe Mulet CLA 2002-12-09 10:41:50 EST
Now caches the rootID on the classpath entry itself, and also changed senders 
to avoid using rootID aware code (some of them).

Fixed.
Comment 2 David Audel CLA 2002-12-18 04:16:32 EST
Verified.