| Summary: | SiteListener canonicalizes filenames many times | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | John Arthorne <john.arthorne> | ||||||
| Component: | p2 | Assignee: | John Arthorne <john.arthorne> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | pascal | ||||||
| Version: | 3.6 | Keywords: | performance | ||||||
| Target Milestone: | 3.6 RC2 | Flags: | pascal:
review+
dj.houghton: review+ |
||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 168939 [details]
Profiler output
Created attachment 168944 [details]
Fix v01
Simple fix to normalize filenames only once during construction
Note that even with the fix, this is O(n^2) cost, and could potentially be made faster by sorting the list of files X. However because it currently does an endsWith comparison this fix would be fairly complicated and I'm not sure it would end up much faster. The main bottleneck here is the new java.io.File() construction, so removing that should eliminate this code as a hotspot. I think we should do this for RC2. The fix is quite simple and safe - really just moving the canonicalization outside the loop. I will re-run all the tests and then release. Fix released. |
Build: 3.6 RC1 When processing platform.xml, the site listener does this: for each file X in the file system: for each file Y in USER_INCLUDE list: if (X.endsWith(new File(Y).toString()) process file X This means the block "new File(Y).toString() is executed X times for each file Y. In a very large install this adds up to a large performance cost during startup. The purpose of "new File(Y).toString()" is to normalize the filenames - eliminate duplicate slashes, etc. We can make a simple optimization by normalizing all the file names at the beginning so we don't need to do this in the loop.