Bug 543723 - [Performances] Improve the ClassLoaderHelper
Summary: [Performances] Improve the ClassLoaderHelper
Status: REOPENED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 4.2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Camille Letavernier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 543726
Blocks: 546433
  Show dependency tree
 
Reported: 2019-01-23 03:26 EST by Camille Letavernier CLA
Modified: 2019-05-13 04:15 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Camille Letavernier CLA 2019-01-23 03:26:27 EST
Currently, when we reference classes (by Qualified Name) in a model, the only option we have to resolve that class at runtime is to use our ClassLoaderHelper. This helper uses a cache to make sure classes are only resolved once. However, the initial loading uses a buddy-policy: dependent to explore pretty much all bundles that depend on Papyrus (directly or indirectly), in order to find that class.

When this was implemented, we had ~40 bundles or so, but this approach really doesn't scale well with hundreds of bundles. Last year we reached the OSGi Cache limit for bundles; and even when letting XWT use our ClassLoaderHelper to use the cache again, we still have significant initial load times.

The issue becomes worse when we introduce custom class loaders such as E(fx)clipse extension for JavaFX 11.

I see two options to improve on this:

1) Do as everyone else in Eclipse, and add the bundle ID in addition to the Class Qualified Name, so we know exactly in which bundle to look (Using the right class loader rather than exploring hundreds of class loaders). Unfortunately, this requires updating all our metamodels, and all our models as well (Properties, Palettes, Architecture, ElementTypes...). This would be a long term solution. For this, we could use the standard bundleclass:/<bundleID>/<classQName> syntax rather than just using <classQName>
2) Since all the class qualified names that are passed to the ClassLoaderHelper are coming from a Model, and this model was usually loaded via a platform:/plugin/ URI, we can retrieve the initial bundle (Or at least, a Bundle that depends on the Bundle containing the class to load; which is already helpful)

I'll start investigating Option 2), to pass a Model or Extension Point contributor ID to the ClassLoaderHelper, to help narrowing down the list of bundles to explore. Option 1) should be considered on the long term; maybe for 5.0
Comment 1 Eclipse Genie CLA 2019-03-14 06:40:42 EDT
New Gerrit change created: https://git.eclipse.org/r/138724
Comment 3 Eclipse Genie CLA 2019-05-10 13:22:36 EDT
New Gerrit change created: https://git.eclipse.org/r/141989
Comment 4 Patrick Tessier CLA 2019-05-10 13:23:26 EDT
I change it because test was in regression.

Remove deprecated because if not some classes cannot be found.
The method loadClass (name, bundle) cannot find wanted classes...
I have removed call loops:
 loadClass(name) calls loadClass (name, bundle) that can call loadClass(name)....
Comment 5 Patrick Tessier CLA 2019-05-10 13:24:18 EDT
I repopen it because a regression bug was found
Comment 6 Patrick Tessier CLA 2019-05-10 13:24:32 EDT
I repopen it because a regression bug was found