Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344347 - [region] linear search to find a bundle's region hurts performance
Summary: [region] linear search to find a bundle's region hurts performance
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Components (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-29 16:45 EDT by Thomas Watson CLA
Modified: 2011-05-02 16:46 EDT (History)
1 user (show)

See Also:


Attachments
work in progress + performance tests (10.81 KB, patch)
2011-04-29 16:45 EDT, Thomas Watson CLA
no flags Details | Diff
updated patch and tests (23.75 KB, patch)
2011-05-02 16:34 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2011-04-29 16:45:15 EDT
Created attachment 194410 [details]
work in progress + performance tests

org.eclipse.equinox.internal.region.StandardRegionDigraph.getRegion(long) performs a linear search over all regions to find the region a bundle belongs to.  This causes significant slow down for resolve, bundle, service operations.  For example, simply having 100 regions created shows about 4x slowdown in performance of getBundles methods.

I think we need to consider hashing the Bundle->Region relationship similar to how we hashed the Region->Edges relationship.  The attached patch does this.  It also has some performance tests that show the slow down.

In order to run the performance tests you need the following project org.eclipse.core.tests.harness at http://dev.eclipse.org/viewsvn/viewvc.cgi/org.eclipse.core.tests.harness/

Glyn, please take a look.  The patch adds a new global map to digraph that all regions must use to record the Bundle->Region map.
Comment 1 Thomas Watson CLA 2011-05-02 10:15:14 EDT
I forgot that you also need org.eclipse.test.performance:

http://dev.eclipse.org/viewsvn/viewvc.cgi/org.eclipse.test.performance/
Comment 2 Thomas Watson CLA 2011-05-02 16:34:10 EDT
Created attachment 194541 [details]
updated patch and tests

Here is an updated patch.  I decided to remove the ConcurrentMap used to keep the set of bundle ids that belong to a region.  This could potentially make Region.getBundle(String, Version) slower, but I don't think that is a method that gets called very much (if at all).
Comment 3 Thomas Watson CLA 2011-05-02 16:46:20 EDT
I released this last patch.