Bug 239862 - EquinoxBundlesState.installBundle is inefficient
Summary: EquinoxBundlesState.installBundle is inefficient
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M1   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 238312
  Show dependency tree
 
Reported: 2008-07-07 15:36 EDT by Simon Kaegi CLA
Modified: 2008-10-20 14:51 EDT (History)
0 users

See Also:


Attachments
patch (9.61 KB, patch)
2008-07-09 13:02 EDT, Simon Kaegi CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Kaegi CLA 2008-07-07 15:36:40 EDT
The various checks done in "installBundle" to ensure the bundle has both a unique location as well as a unique BSN and version end up resulting in an O(n) set op operations. This is problematic when EquinoxBundlesState.composeState makes this call for each bundle. The net result is a n^2 complexity problem. 

Rather than iterating over each bundle already installed looking for matches we should look at creating the appropriate index in EquinoxBundlesState to reduce the checks in installBundle to a constant time lookup.

See:
EquinoxBundlesState.installBundle (for loop starting on line 607)
Comment 1 Simon Kaegi CLA 2008-07-09 13:02:20 EDT
Created attachment 106977 [details]
patch

This patch adds indexes on the state for location and the bsn/version pair. One thing to note is that the location index is by the "real location" so to ensure a match the location key must be normalized using FileUtils.getRealLocation before performing a lookup.
Comment 2 Simon Kaegi CLA 2008-07-14 17:44:35 EDT
I've committed to the 3.5 stream to allow further testing.
Comment 3 Simon Kaegi CLA 2008-08-08 01:44:06 EDT
Marking fixed along with bug 238312