Bug 51249 - Performance problems in PackageFragment.getPath
Summary: Performance problems in PackageFragment.getPath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2004-02-05 12:29 EST by Dani Megert CLA
Modified: 2004-02-12 13:05 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2004-02-05 12:29:22 EST
I20040204

I was tracing performance when opening an editor and found that > 7% is spent
when the decoration scheduler calls toString() on the elements (mostly Java
Elements) for the subTask label. I filed bug 51244 for this.

JavaElement.toString >...> PackageFragment.getPath calls Path.append and which
ends up calling Path.computeSegments which calls String.substring and which
finally burns the cycles. I filed bug 51246 to improve Path.computeSegments.

Maybe you can improve the getPath methods e.g. by not computing same information
(like package path) several times.
Comment 1 Jerome Lanneluc CLA 2004-02-06 04:49:43 EST
Fixed CompilationUnit.isWorkingCopy() to not use the path to get the info, but 
the handle itself.
Comment 2 Dani Megert CLA 2004-02-06 05:06:52 EST
Could you also do something about PackgeFragment.getPath ? I saw this as hot
spot in other scenarios (not via isWorkingCopy)
Comment 3 Jerome Lanneluc CLA 2004-02-06 05:10:39 EST
Sorry, the only solution would be to cache it on the handle object itself, 
which would cost to much memory. Please enter another bug report for the other 
case, and I'll see if I can 'not call' getPath().
Comment 4 Dani Megert CLA 2004-02-06 05:17:07 EST
Fair enough.
If you send me a preview I can verify that it improved and trace the other cases.
Comment 5 Jerome Lanneluc CLA 2004-02-06 05:44:30 EST
Posted preview (v_404a) on JDT Core home page
Comment 6 Dani Megert CLA 2004-02-06 08:37:35 EST
The fix does its job. 

The other paths can be neglected, they only appeared because the item itself was
on the top list.
Comment 7 Frederic Fusier CLA 2004-02-12 13:05:51 EST
Verified for 3.0-M7 with build 200402120010.