Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Very high loading times of models with ID feature
Very high loading times of models with ID feature [message #1754259] Wed, 15 February 2017 19:53 Go to next message
Bugra M. Yildiz is currently offline Bugra M. YildizFriend
Messages: 106
Registered: July 2014
Senior Member
Hello,

I have Java code that uses EMF Reflective library to load the models (model instances, not metamodels). For the models whose metamodel includes a feature serves as an ID, the loading of the model takes ages: 45 minutes for a model of size 20 MB.

I have tried to set the options of loading the models as described in multiple places:

https://www.eclipse.org/forums/index.php/t/929918/
https://www.eclipse.org/modeling/emf/docs/performance/EMFPerformanceTips.html
http://www.jevon.org/wiki/Improving_EMF_Model_Loading_Performance
https://sdqweb.ipd.kit.edu/wiki/EMF_Model_Loading_Performance_Tweaks

There is no change in the performance as reported in some other post:
https://sdqweb.ipd.kit.edu/wiki/EMF_Model_Loading_Performance_Tweaks .

I need help with this issue.

Thank you.
Re: Very high loading times of models with ID feature [message #1754277 is a reply to message #1754259] Thu, 16 February 2017 06:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29456
Registered: July 2009
Senior Member
I see the last link mentions using an intrinsic map. I suspect you've not done this. Any time you have bad performance, it's worth your while to use a tool like YourKit to measure what specifically is so slow. It's likely this would point at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectByID(String) as a bottleneck and then you'd look at the code and quickly see how the intrinsic map would improve things:
  protected EObject getEObjectByID(String id)
  {
    Map<String, EObject> map = getIntrinsicIDToEObjectMap();
    if (map != null)
    {
      EObject eObject = map.get(id);
      if (eObject != null)
      {
        return eObject;
      }
    }
Re: Very high loading times of models with ID feature [message #1754318 is a reply to message #1754277] Thu, 16 February 2017 11:08 Go to previous messageGo to next message
Bugra M. Yildiz is currently offline Bugra M. YildizFriend
Messages: 106
Registered: July 2014
Senior Member
You are right, after putting the map, it started working much faster. Thanks for the help and response.
Re: Very high loading times of models with ID feature [message #1754334 is a reply to message #1754277] Thu, 16 February 2017 12:52 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 840
Registered: July 2009
Senior Member
Hi Ed,
I have seen people often fall into this trap:
Can't EMF provide that setting by default? What is the reason for explicitly setting the map?

Ed Merks wrote on Thu, 16 February 2017 07:55
I see the last link mentions using an intrinsic map. I suspect you've not done this. Any time you have bad performance, it's worth your while to use a tool like YourKit to measure what specifically is so slow. It's likely this would point at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectByID(String) as a bottleneck and then you'd look at the code and quickly see how the intrinsic map would improve things:
  protected EObject getEObjectByID(String id)
  {
    Map<String, EObject> map = getIntrinsicIDToEObjectMap();
    if (map != null)
    {
      EObject eObject = map.get(id);
      if (eObject != null)
      {
        return eObject;
      }
    }

Re: Very high loading times of models with ID feature [message #1754349 is a reply to message #1754334] Thu, 16 February 2017 15:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29456
Registered: July 2009
Senior Member
A default where though? Changing behavior for existing clients tends to invite new problems...
Re: Very high loading times of models with ID feature [message #1754350 is a reply to message #1754349] Thu, 16 February 2017 15:55 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 840
Registered: July 2009
Senior Member
So, the reason to set the map manually and not by default is to not break compatibility?
Maybe, provide an addtional resource option as most people first look at what options are available.
Example:
loadOptions.put(XMLResource.OPTION_USE_INTRINSIC_ID_MAP, Boolean.TRUE);
Re: Very high loading times of models with ID feature [message #1754376 is a reply to message #1754350] Fri, 17 February 2017 05:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29456
Registered: July 2009
Senior Member
How about adding Javadoc to the org.eclipse.emf.ecore.xmi.XMLResource.OPTION_DEFER_IDREF_RESOLUTION option? E.g.,
   * For best performance resolving IDs,
   * it's most effective to use this option set to true in conjunction with an {@link ResourceImpl#setIntrinsicIDToEObjectMap(Map) intrinsic ID map},
   * which is best set in the {@link Resource.Factory#createResource(URI) resource factory}.
If people are actually looking at that, they can read it, and know what needs to be done, without yet another mechanism for doing it (which they'd have to look for and read as well). Please open a Bugzilla if you think that's an improvement.
Previous Topic:Load an ecore file programmatically
Next Topic:get name/address of model
Goto Forum:
  


Current Time: Fri Jul 20 12:52:33 GMT 2018

Powered by FUDForum. Page generated in 0.02401 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top