Bug 535341 - StateImpl#getBundles should use a cache to look up bundles per name
Summary: StateImpl#getBundles should use a cache to look up bundles per name
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 4.8.0 Photon   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.9 M2   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2018-05-30 11:14 EDT by Karsten Thoms CLA
Modified: 2018-06-01 10:26 EDT (History)
1 user (show)

See Also:


Attachments
Screenshot: Profiler (250.46 KB, image/png)
2018-05-30 11:14 EDT, Karsten Thoms CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2018-05-30 11:14:08 EDT
Created attachment 274261 [details]
Screenshot: Profiler

I am examining a UI test class and the target platform resolution takes a while. The profiler shows a hot spot for StateImpl#getBundles, which takes ~9s during the startup of the plugin test.

I employed a counter and this shows me that the method is called 16.800 times on a bundleDescriptions list with 16.822 entries. It does a sequential search for bundles with the searched name.

It would be more efficient when the bundle names are looked up in a map. This would reduce the time to almost nothing.
Comment 1 Thomas Watson CLA 2018-05-30 12:28:17 EDT
Makes sense to me.  If you want to contribute then be aware that any new Map<String, Collection<BundleDescripton> should be managed in StateImpl.removeBundle and StateImpl.basicAddBundle and StateImpl.updateBundle.  Basically any time the org.eclipse.osgi.internal.resolver.StateImpl.bundleDescriptions KeyedHashSet is modified.
Comment 2 Eclipse Genie CLA 2018-06-01 03:33:27 EDT
New Gerrit change created: https://git.eclipse.org/r/123787
Comment 3 Karsten Thoms CLA 2018-06-01 06:58:39 EDT
Any chance that this could make it still into Photon?
Comment 4 Thomas Watson CLA 2018-06-01 08:57:49 EDT
(In reply to Karsten Thoms from comment #3)
> Any chance that this could make it still into Photon?

I think it is too late for that.  At this point we are just releasing blockers.  AFAICT this performance issue has been around for many releases.
Comment 5 Karsten Thoms CLA 2018-06-01 09:29:00 EDT
OK, thought so. Will be the first improvement for 4.9 then :)