Bug 156425

Summary: Performance problems in Element.validateNotOwnSelf
Product: [Modeling] MDT.UML2 Reporter: Christian Damus <give.a.damus>
Component: CoreAssignee: Kenn Hussey <Kenn.Hussey>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 Keywords: performance
Version: 2.0.0   
Target Milestone: 2.0.1   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch that fixes the problem for me none

Description Christian Damus CLA 2006-09-06 15:45:16 EDT
The implementation of the Element.validateNotOwnSelf constraint has two performance/scalability issues:

  - calling Element.allOwnedElements() has O(n) complexity.  Checking whether
    any owner (recursively) is self would have O(log(n)) complexity
  - calling Element.allOwnedElements() causes all containment proxies to
    be resolved, loading additional resources unnecessarily

Both of these problems could be resolved by checking the container chain of the element.
Comment 1 Christian Damus CLA 2006-09-06 15:47:04 EDT
Created attachment 49531 [details]
Patch that fixes the problem for me

Attached a patch that fixes the problem for me.  With this change, I no longer get unwanted containment proxy resolution and it seems to perform faster.  I have not tested, though, whether the constraint with this patch still catches ownership cycles.
Comment 2 Kenn Hussey CLA 2006-09-06 16:52:57 EDT
The fix has been committed to CVS.
Comment 3 Kenn Hussey CLA 2006-09-07 15:48:11 EDT
Fixed in M200609071509.
Comment 4 Nick Boldt CLA 2008-01-28 16:36:12 EST
Move to verified as per bug 206558.